Salı, Mart 18, 2008

Python UnicodeDecode

If you get an error like this
>> bytestring = '\xc3\xa4'     # Uuh, some non-ASCII bytestring!
>>> german_ae += bytestring
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0:
ordinal not in range(128)
then you must do
german_ae.decode('latin1').
here is the discussion
http://www.onlamp.com/pub/a/python/excerpt/pythonckbk_chap1/index.html



Hiç yorum yok: