0

Now I get some info via http request. But I find the String can not be parsed to the correct charset. This is my code:

req = urllib2.Request(URL, urllib.urlencode({"token": token}))
resp = urllib2.urlopen(req)
result = resp.read()
print result  #\u8c22\u777f
print repr(result ) #'\\u8c22\\u777f'

The correct string should be \u8c22\u777f, but the \u is escaped to \\u. What shall I do?

Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186
xierui
  • 1,047
  • 1
  • 9
  • 22

0 Answers0