Skip to content

Instantly share code, notes, and snippets.

@kylegibson
Created July 31, 2014 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylegibson/a5b32e37f8961968f065 to your computer and use it in GitHub Desktop.
Save kylegibson/a5b32e37f8961968f065 to your computer and use it in GitHub Desktop.
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