urllib.unquote and unicode

Peter Otten __peter__ at web.de
Tue Dec 19 03:57:49 EST 2006


George Sakkis wrote:

> The following snippet results in different outcome for (at least) the
> last three major releases:
> 
>>>> import urllib
>>>> urllib.unquote(u'%94')

> # Python 2.4.2
> UnicodeDecodeError: 'ascii' codec can't decode byte 0x94 in position 0:
> ordinal not in range(128)

Python 2.4.3 (#3, Aug 23 2006, 09:40:15)
[GCC 3.3.3 (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> urllib.unquote(u"%94")
u'\x94'
>>>

>From the above I infer that the 2.4.2 behaviour was considered a bug.

Peter




More information about the Python-list mailing list