How to properly url encode accents?

I need to url encode foreign names, like "Misère".

When I do:

urllib2.quote(name)

I get a the error:

File "/System/Library/Frameworks/Python.framework/Versions/
2.5/lib/python2.5/urllib.py", line 1205, in quote
    res = map(safe_map.__getitem__, s)
KeyError: u'\xe8'

What am I doing wrong?

6
задан Will Curran 7 February 2011 в 17:17
поделиться