Dealing with Python 2.x UnicodeDecodeErrors
Tired of seeing this?
<type 'exceptions.UnicodeDecodeError'> at /such/and/such 'ascii' codec can't decode byte 0xf8 in position 12: ordinal not in range(128)
So am I. I had a bytestring with extended characters in it:
data = '\xfcnic\xf8de test'
And no matter what I tried:
…I kept getting errors. Turns out those extended characters simply aren’t in the utf-8 codec, so I tried latin-1:
And it works! At long last!!