This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Stephen.Day
Recipients Stephen.Day
Date 2012-01-25.22:12:01
SpamBayes Score 2.63085e-11
Marked as misclassified No
Message-id <>
The current behavior of the urlencode function (2.7: urllib, 3.x: urllib.parse) encodes spaces as pluses:

>>> from urllib import urlencode
>>> urlencode({'a': 'some param'})

However, in most instances, it would be desirable to merely encode spaces using percent encoding:

>>> urlencode({'a': 'some param'})

But there is no way to get this behavior in the standard library. 

It would probably best to change this so it defaults to use the regular quote function, but allows callers who need the legacy quote_plus behavior to pass that in as a function parameter.

An acceptable fix would be to have the quote function taken as a keyword parameter, so legacy behavior remains:

>>> urlencode({'a': 'some param'})

Then the behavior could be adjusted where needed:

>>> from urllib import quote
>>> urlencode({'a': 'some param'}, quote=quote)
Date User Action Args
2012-01-25 22:12:02Stephen.Daysetrecipients: + Stephen.Day
2012-01-25 22:12:02Stephen.Daysetmessageid: <>
2012-01-25 22:12:01Stephen.Daylinkissue13866 messages
2012-01-25 22:12:01Stephen.Daycreate