UnicodeEncodeError - opening encoded URLs

Peter Otten __peter__ at web.de
Sat Mar 28 05:04:56 EDT 2009


D4rko wrote:

>> (Unless "name" is a unicode object as well.)
> 
> Unfortunately it is, it's the argument that is automagically handed to
> the handler function by the Django URL dispatcher. I guess I may need
> to encode it back to the pure ascii with the "%xx" things, but I can't
> find the function that would do it. Any idea?

>>> urllib.quote(u"Środkowa".encode("utf8"))
'%C5%9Arodkowa'

Peter



More information about the Python-list mailing list