Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unicode issue with urllib quote and unquote
from urllib import unquote, quote
a = u'\u2022'
print a
b = a.encode('utf-8')
print b
c = quote(b)
print c
d = unicode(c)
print d
e = unquote(d)
# e here is a unicode string with utf-8 characters, so we see garbage
print e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment