Bug Tracker

Opened 11 years ago

Closed 11 years ago

#4315 closed bug (duplicate)

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!

Change History (3)

comment:1 Changed 11 years ago by JDay

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?

comment:2 Changed 11 years ago by braillane

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

comment:3 Changed 11 years ago by dmethvin

Resolution: duplicate
Status: newclosed

See the discussion at #3611.

Note: See TracTickets for help on using tickets.