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

Fixes for querystring encode/decode #13

Merged
merged 1 commit into from
Jan 14, 2013

Conversation

agriffis
Copy link
Collaborator

This commit brings three fixes to qs_encode and qs_decode:

  1. Use quote_plus/unquote_plus rather than quote/unquote so that spaces are encoded as +.
  2. Avoid implicit s.decode in qs_encode. This happens if a str is passed to qs_encode, since s.encode in that case needs to decode first.
  3. Avoid implicit s.encode in qs_decode. This happens because of calling str(s).

The implicit conversions use the (platform and environment dependant) default encoding, so it's better to avoid them and explicitly handle unicode objects with deliberate encode/decode to utf-8.

@zacharyvoase
Copy link
Owner

Awesome; I really like the changes you've made, but you set me thinking about + versus %20. I stumbled across this StackOverflow question, and I agree that + should be used for query strings.

In summary: all good.

zacharyvoase added a commit that referenced this pull request Jan 14, 2013
* Query strings should use '+' to encode spaces.
* Don't unnecessarily (en|de)code unicode <=> bytes.
@zacharyvoase zacharyvoase merged commit f72af71 into zacharyvoase:master Jan 14, 2013
@zacharyvoase
Copy link
Owner

This has just been released as v2.2.0.

@agriffis
Copy link
Collaborator Author

Sweet, thanks. That's quick turnaround.

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

Successfully merging this pull request may close these issues.

2 participants