On Apr 27, 2007, at 1:22 PM, Xavier Noria wrote:
>
> If I serialize a form with two textfields with the same name and
> spaces in their values end up encoded as "%252520", instead of
"%20",
> does that ring any bell?
>
> I''ve reduced the problem to this minimal example:
>
> <form id="f" action="none">
>    <p>First field: <input type="text" name="t"
value="foo bar" /></p>
>    <p>Second filed: <input type="text"
name="t" value="baz woo" /></p>
> </form>
> <p>
> <a onclick="new Ajax.Updater(''dump'',
''/test/dump'',
> {asynchronous:true, evalScripts:true, parameters:Form.serialize
> (''f'')}); return false;" href="#">Dump
form</a>
> </p>
> <pre id="dump">
> </pre>
>
> The call sends
>
>    t=foo%252520bar&t=baz%252520woo
>
> Does that ring any bell?
Ah, it looks like it''s a bug in Prototype 1.5.0, there''s
indeed a
double encodeURIComponent call in toQueryString, this is the fix:
--- orig_prototype.js	2007-04-27 13:33:50.000000000 +0200
+++ prototype.js	2007-04-27 13:34:38.000000000 +0200
@@ -647,7 +647,7 @@
          	key = encodeURIComponent(pair.key);
            values.each(function(value) {
              value = value != undefined ? encodeURIComponent 
(value) : '''';
-            parts.push(key + ''='' +
encodeURIComponent(value));
+            parts.push(key + ''='' + value);
            });
            return;
          }
The implementarion of toQueryString in the current 1.5.1_rc3 is  
different, I guess it works OK there.
-- fxn
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---