I have a Unicode string I'm retrieving from a web service in python.
I need to access a URL I've parsed from this string, that includes various diacritics.
However, if I pass the unicode string to urlllib2
, it produces a unicode encoding error. The exact same string, as a "raw" string r"some string"
works properly.
How can I get the raw binary representation of a unicode string in python, without converting it to the system locale?
I've been through the python docs, and every thing seems to come back to the codecs
module. However, the documentation for the codecs
module is sparse at best, and the whole thing seems to be extremely file oriented.
I'm on windows, if it's important.