I have a unicode string that was encoded on the client side using JS encodeURIComponent.
If I use the following in Python locally, I get the expected result:
>>> urllib.unquote("Foo%E2%84%A2%20Bar").decode("utf-8")
>>> u'Foo\u2122 Bar'
But when I run this in Google App Engine, I get:
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 703, in __call__
handler.post(*groups)
File "/base/data/home/apps/s~kaon-log/2.357769827131038147/main.py", line 143, in post
path_uni = urllib.unquote(h.path).decode('utf-8')
File "/base/python_runtime/python_dist/lib/python2.5/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 3-5: ordinal not in range(128)
I'm still using Python 2.5, in case that makes a difference. What am I missing?