Created
July 31, 2014 16:17
-
-
Save kylegibson/a5b32e37f8961968f065 to your computer and use it in GitHub Desktop.
Unicode issue with urllib quote and unquote
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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