urlib.quote gives KeyError in Python 2.4.4 but workin 2.3.5

nyenyec nyenyec at gmail.com
Sun Jan 7 13:48:17 EST 2007


urllib.quote chokes on unicode in 2.4.4.

>>> print sys.version
2.4.4 (#1, Oct 18 2006, 10:34:39)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)]
>>> urllib.quote(u"\xe9")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/urllib.py",
line 1117, in quote
    res = map(safe_map.__getitem__, s)
KeyError: u'\xe9'

but it seems to work in Python 2.3.5

Python 2.3.5 (#1, Aug 19 2006, 21:31:42)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, urllib
>>> print sys.version
2.3.5 (#1, Aug 19 2006, 21:31:42)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)]
>>> urllib.quote(u'\xe9')
'%E9'

Is this a known bug?

What's the workaround?

Thanks,
nyenyec




More information about the Python-list mailing list