Bug Tracker

Modify

Ticket #11750 (closed bug: invalid)

Opened 13 months ago

Last modified 13 months ago

Double encoding in $.param

Reported by: kondrat Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

Description

If you use $.param with already encoded value you'll get wrong value

E.g.: $.param( {paramName: "36.593812%2C50.59396"} transforms to string "paramName=36.593812%252C50.59396"

But expected value was "paramName=36.593812%2C50.59396" I think using decodeURIComponent for each param( maybe optional ) will fix this problem properly.

Change History

comment:2 follow-ups: ↓ 3 ↓ 4 Changed 13 months ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

Nope. $.param() has no business trying to guess whether you are double-encoding your string. That's up to you.

comment:3 in reply to: ↑ 2 Changed 13 months ago by kondrat

Replying to dmethvin:

Nope. $.param() has no business trying to guess whether you are double-encoding your string. That's up to you.

Actually if you encode param when convert object to string, you should give ability to disable encode function.

comment:4 in reply to: ↑ 2 Changed 13 months ago by kondrat

Replying to dmethvin:

Nope. $.param() has no business trying to guess whether you are double-encoding your string. That's up to you.

Please look at example again, it's double-encoding after $.param, and problem is in $.param, because it's using encodeURIComponent without ability to disable it

Last edited 13 months ago by kondrat (previous) (diff)

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.