August 18th, 2003, 02:34 PM
UTF-8 decoding error: unexpected code byte
I have a string that contains the "utf-8" code for the deg symbol:
strQuoted="The temperature is: 85\xb0"
I then have the following code obtained from SLiP (a 'Sorta Like Python' shorthand for XML) package used to convert .slp files to .xml:
strUTF8 = strQuoted.encode("utf-8")
strUnquoted = eval(strUTF8)
strUnquoted = unicode(strUnquoted, "utf-8")
I'm getting the following error:
UnicodeError: UTF-8 decoding error: unexpected code byte
Is this error occurring because I already have "utf-8" code in my string and I'm trying to convert that code to "utf-8"? Can anyone tell me how to get around this issue? The python class does not support Unicode, but does support UTF-8.
Any help is greatly appreciated. Thanks...