I am trying to encode and store and decode arguments in Python and get lost somewhere along the way. Here are my steps:
1) I am using the google toolkit gtm_stringByEscapingForURLArgument to properly convert an NSString to pass HTTP arguments.
2) On my server (python), I store these string arguments as something like u'1234567890-/:;()$&@".,?!\'[]{}#%^*+=_\\|~<>\u20ac\xa3\xa5\u2022.,?!\'' (note that these are standard keys on the iphone keyboard in the “123” and “# + =” views, there are some \u and \x characters in it money prefixes such as pound, yen, etc.)
3) I call urllib.quote(myString,'') on this stored value, presumably to have% -escape them for transport on the client so that the client can slip away from them.
As a result, I get an exception when I try to write the result of% escaping. Is there any important step that I am losing sight of that needs to be applied to the stored value using the \ u and \ x format in order to properly convert it for sending via http?
Update . The sentence, marked as the answer below, worked for me. However, I am providing some updates to satisfy the comments below.
The exception I received caused a problem with \u20ac . I do not know if the problem was with this specifically, and not the fact that it was the first unicode character in the string.
That \u20ac char is unicode for the euro character. Basically, I found that I would have problems with it if I had not used the urllib2 quote method.
python url-encoding
Joey Aug 25 2018-10-10T00: 00Z
source share