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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
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 <eliteii92g-NPSFNn/7+NYVo650/ln6uw@public.gmane.org> 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> (de|en)codeURIComponent is for sending via get/post specifically and not much else afaik.. which is not the intended purpose of escape.<br> <br> Spiceee wrote: <blockquote cite="mid:ba1c5c9f0704011414p57bef9ees2b7d8193a73ac562-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org" type="cite"> <pre wrap="">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 </pre> <blockquote type="cite"> <pre wrap="">var paramHash = paramString.toQueryParams(); </pre> </blockquote> <pre wrap=""><!----> 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 <a class="moz-txt-link-rfc2396E" href="mailto:eliteii92g-NPSFNn/7+NYVo650/ln6uw@public.gmane.org"><eliteii92g-NPSFNn/7+NYVo650/ln6uw@public.gmane.org></a> wrote: </pre> <blockquote type="cite"> <pre wrap="">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: </pre> <blockquote type="cite"> <pre wrap="">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. </pre> <pre wrap=""> </pre> </blockquote> <pre wrap=""> </pre> </blockquote> <pre wrap=""><!----> </pre> </blockquote> <br> --~--~---------~--~----~------------~-------~--~----~<br> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. <br> To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en <br> -~----------~----~----~----~------~----~------~--~---<br> </body> </html> <br>
Well, it''s a GET request in the end so it''s supposed to pull the trick. Come to think of it, I''ve had to use it instead of escape() in the past while passing vars to Flash Movies (which use utf8 by default). If Prototype''s supposed to work with a callback function that escape()''s the query string it returns, then be warned that up to 1.5.1_rc1 it doesn''t work with utf8 encoded pages/forms. Regards, Fabio. On 4/2/07, Colin Mollenhour <eliteii92g-NPSFNn/7+NYVo650/ln6uw@public.gmane.org> wrote:> > (de|en)codeURIComponent is for sending via get/post specifically and not > much else afaik.. which is not the intended purpose of escape. > > > Spiceee wrote: > 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 <eliteii92g-NPSFNn/7+NYVo650/ln6uw@public.gmane.org> 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> See the w3schools docs: <a class="moz-txt-link-freetext" href="http://www.w3schools.com/jsref/jsref_escape.asp">http://www.w3schools.com/jsref/jsref_escape.asp</a> Specifically the notes:<br> <b>Note:</b> The escape() and unescape() functions should not be used to encode or decode URIs. Use encodeURI() and decodeURI() functions instead!<br> <br> Spiceee wrote: <blockquote cite="mid:ba1c5c9f0704012334x5f5472e0u82ffb9b45c65cdb8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org" type="cite"> <pre wrap="">Well, it''s a GET request in the end so it''s supposed to pull the trick. Come to think of it, I''ve had to use it instead of escape() in the past while passing vars to Flash Movies (which use utf8 by default). If Prototype''s supposed to work with a callback function that escape()''s the query string it returns, then be warned that up to 1.5.1_rc1 it doesn''t work with utf8 encoded pages/forms. Regards, Fabio. On 4/2/07, Colin Mollenhour <a class="moz-txt-link-rfc2396E" href="mailto:eliteii92g-NPSFNn/7+NYVo650/ln6uw@public.gmane.org"><eliteii92g-NPSFNn/7+NYVo650/ln6uw@public.gmane.org></a> wrote: </pre> <blockquote type="cite"> <pre wrap=""> (de|en)codeURIComponent is for sending via get/post specifically and not much else afaik.. which is not the intended purpose of escape. Spiceee wrote: 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 <a class="moz-txt-link-rfc2396E" href="mailto:eliteii92g-NPSFNn/7+NYVo650/ln6uw@public.gmane.org"><eliteii92g-NPSFNn/7+NYVo650/ln6uw@public.gmane.org></a> 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. > </pre> </blockquote> <pre wrap=""><!----> </pre> </blockquote> <br> --~--~---------~--~----~------------~-------~--~----~<br> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. <br> To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en <br> -~----------~----~----~----~------~----~------~--~---<br> </body> </html> <br>