Sunday, 15 May 2011

Recode bytes which cannot be decoded in utf-8 in python -


Reading from textile files - is a byte that is causing problems for me to encode:

  

Ex> Unicodecode error: 'utf8' can not decode the byte 0xc3 in codec position 26: Invalid continuity byte

Is it also to specify that I have these bytes How to handle it (i.e. To make this byte as another character?)

depending on what you want , Try using unicodecsv or unicodecsv.reader (f, delimiter = "|", errors = 'ignore') Reader (f, delimiter = "|" , Errors = 'replace') . UnicodeSave passes through errors parameters in Unix encoding. See help for Unicode or more information.


No comments:

Post a Comment