Python urlencode for unicode string
// python urlencode usually throws error when encoding unicode string, here's the tricks
import types,urllib
def unicode_urlencode(value):
if type(value) is types.UnicodeType:
return urllib.quote(value.encode("utf-8"))
else:
return urllib.quote(value)
0 Comments