Bug in Python 2.6 urlencode

John Nagle nagle at animats.com
Wed Sep 8 01:17:38 EDT 2010


On 9/7/2010 9:56 PM, Ned Deily wrote:
> In article<4c87013f$0$1625$742ec2ed at news.sonic.net>,
>   John Nagle<nagle at animats.com>  wrote:
>> On 9/7/2010 5:43 PM, Terry Reedy wrote:
>>> On 9/7/2010 3:02 PM, John Nagle wrote:
>>>> There's a bug in Python 2.6's "urllib.urlencode". If you pass
>>>> in a Unicode character outside the ASCII range, instead of it
>>>> being encoded properly, an exception is raised.
....
>>
>>       In other words, we're in the version suckage period.
>
> It took me all of one minute to find where a similar issue was reported
> previously (http://bugs.python.org/issue1349732).  One of the comments
> on the issue explains how to use the "doseq" form and an explicit encode
> to handle Unicode items.  I don't see where that part of the suggestion
> made it into the documentation.  I'm sure if you make a specific doc
> change suggestion, it will be incorporated into the 2.7 docs.  If you
> think a code change is needed, suggest a specific patch.

    That's a very funny bug report.

    The report was created back in 2005:

	Title: urllib.urlencode provides two features in one param
	Type: 	feature request 	Stage: 	committed/rejected

    It wasn't listed as an actual bug.

    On 2005-12-29, "Mike Brown" writes "However, I was unable to 
reproduce your observation that doseq=0 results in urlencode
not knowing how to handle unicode. The object is just passed to str()."
This was back in the Python 2.4 days, when "str" restriction to ASCII
wasn't enforced.  Perhaps the original reporter and the developer
were using different versions.

    Five years later (!) Terry J. Reedy writes '"put something 
somewhere" will not get action.'

    In July 2010, Senthil Kumaran writes "This was fixed as part of 
Issue8788. Closing this."  Issue 8788 is a documentation fix only.

				John Nagle







More information about the Python-list mailing list