I have an Android app which uses
URLEncoder.encode(S.getSongArtist(),"UTF-8")
to encode a unicode string that is posted to a AppEngine python (2.7) web service. On the service I use
urllib.unquote_plus(artist)
This is not giving me correct results. I have an input like this:
Marie+Lafor%C3%AAt
which is unquote'd to
Marie Laforêt
If I use a javascript url decode, for instance: http://meyerweb.com/eric/tools/dencoder/ I get
Marie Laforêt
A correct result.
I tried using
urllib.unquote(artist).decode('utf-8')
but this generates an exception. Any hints at all are greatly appreciated.
EDIT
Taxellool had the right answer in the comments:
what you are trying to decode is already decoded. try this:
urllib.unquote_plus(artist.encode('utf-8')).decode('utf-8')
Taxellool had the right answer in the comments:
what you are trying to decode is already decoded. try this:
I guess you are decoding before urllib.unquote():
If you decode after unquote, result would be what you want:
Just make sure you don't pass a unicode to urllib.unquote_plus.