Skip to main content

Bug Tracker

Side navigation

#4315 closed bug (duplicate)

Opened March 09, 2009 02:24PM UTC

Closed March 21, 2009 05:16PM UTC

Jquery.param encoding wrong

Reported by: braillane Owned by:
Priority: critical Milestone: 1.4
Component: core Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

Hello,

I think that the param function doesn't work well, it doesn't encode to the url format.

For example :

jQuery.param({test:"béton"})

return :

test=b%C3%A9ton

while it has to return :

test=b%E9ton

This problem is present in the form plugin, the ajax.submit function use "param" and so it doesn't work well too.

Thanks!

Attachments (0)
Change History (3)

Changed March 10, 2009 12:40AM UTC by JDay comment:1

jQuery encodes using encodeURIComponent() which is the recommended function to use in the situation, see: http://xkr.us/articles/javascript/encode-compare/ Also, make sure decodeURIComponent() is being used to manually decode parameters.

The results above look like they were produced by escape(). That function doesn't escape the '+' character, among others. This would be interpreted as a space on the server i.e. '2+2=4' would be misinterpreted as '2 2=4'.

Is there a situation in which the current behavior is broken for you?

Changed March 10, 2009 09:05AM UTC by braillane comment:2

I have just realized that the encodeURIComponent doesn't encode properly for the URL...

I think that it's very important to have a function that encode for url, a mix between escape and encodeURIComponent.

I know that the problem doesn't came directly from jquery, but it's a bug, for the ISO-8859-1 encoding (used in europe) it's a big problem, the param function (and all function that use it) becomes useless!

Like i said the form plugin use it in the ajaxSubmit function and so i can't use it without takingg care, in my target page, of the decoding.

Thanks and sorry for my english :S

Changed March 21, 2009 05:16PM UTC by dmethvin comment:3

resolution: → duplicate
status: newclosed

See the discussion at #3611.