Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String.QueryString: fix bug decoding '+' #1313

Closed
wants to merge 2 commits into from

Conversation

@danielbeardsley
Copy link
Contributor

danielbeardsley commented Jun 25, 2015

decodeURIComponent doesn't do the correct thing with query parameter
keys or values. Specifically, it leaves '+' as '+' when it should be
converting them to spaces as that's the specification. When browsers
submit HTML forms via GET, the values are encoded using
the 'application/x-www-form-urlencoded' mime type which converts
spaces to '+'. decodeURIComponent() will then give incorrect results
on components of the query string.

See: http://unixpapa.com/js/querystring.html for a description of the
problem.

decodeURIComponent doesn't do the correct thing with query parameter
keys or values. Specifically, it leaves '+' as '+' when it should be
converting them to spaces as that's the specification. When browsers
submit HTML forms via GET, the values are encoded using
the 'application/x-www-form-urlencoded' mime type which converts
spaces to '+'. decodeURIComponent() will then give incorrect results
on components of the query string.

See: http://unixpapa.com/js/querystring.html for a description of the
problem.
@SergioCrisostomo SergioCrisostomo added this to the 1.5.2 milestone Jun 25, 2015
String.replace only replaces the first occurrence when the search is specified
as a string.
@danielbeardsley
Copy link
Contributor Author

danielbeardsley commented Jul 1, 2015

Thanks @sctice !

@SergioCrisostomo
Copy link
Member

SergioCrisostomo commented Aug 10, 2015

LGTM 👍

@anutron
Copy link
Member

anutron commented Aug 10, 2015

👍

@SergioCrisostomo
Copy link
Member

SergioCrisostomo commented Aug 10, 2015

added via 8abfa00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.