I'm using 1.5.1_rc1, since it's the last one with a Scriptaculous
release as well.
I've tried your snipped only it never gets passed
> var paramHash = paramString.toQueryParams();
since it's the toQueryParams() call (with following decodeURIComponent
call) that seems to be the problem.
I've tried a couple of things, yelled "This is Sparta!!!!" a couple of
times to my macbook and finally realized it could be that Prototype is
using decodeURIComponent instead of unescape and the two functions
might handle those special latin chars differently in a pure utf8 env.
I've started using encodeURIComponent in the callback and things
started working.
I'm guessing this might come in handy to a lot of people, since
escape() is what's widely used in callback function examples for both
Prototype and Scriptaculous.
Cheers,
fabio.
On 4/1/07, Colin Mollenhour <[EMAIL PROTECTED]> wrote:
>
> What version of Prototype are you using? The 1.5.1_x versions convert
> the parameters property into a hash using String#toQueryParams and then
> back to a string using Hash.toQueryString so you might want to test your
> callback string with these functions.. i.e.
>
> callback:function(form, value) {
> var paramString = 'id=' + escape('137') + '&tags=' + escape(value);
> var paramHash = paramString.toQueryParams();
> if(paramString != Hash.toQueryString(paramHash)){
> alert('not equal!');
> }
> console.debug(paramString); //firebug
> console.debug(Hash.toQueryString(paramHash));
> return paramString;
> }
>
> If you get the "not equal!" alert or the same "malformed URI sequence"
> error, let us know and report the problem on the Prototype:Core google
> group.
>
> Colin
>
> Spiceee wrote:
> > Hey,
> >
> > Why would this "id=137&tags=com%E9dia%2C%20lala" spawn a "malformed
> > URI sequence" error on both Firefox and Safari when using
> > InPlaceEditor?
> >
> > All I'm doing is:
> >
> > //<![CDATA[
> > new Ajax.InPlaceEditor('tags', 'add_tags/', {rows:1,
> > callback:function(form, value) { return 'id=' + escape('137') +
> > '&tags=' + escape(value) }})
> > //]]>
> >
> > When I remove the escape from the tags value the problem goes away (at
> > least for the utf8 encoded strings, which seems to be the source of
> > the problem), but if any special URI char is entered in tags (such as
> > &, = or ?) it spoils the whole query...
> >
> > Firefox fails at this line of prototype:
> >
> > 237 var value = pair[1] ? decodeURIComponent(pair[1]) : undefined;
> >
> > Thanks,
> >
> > fabio.
> >
> > >
> >
> >
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---