I am exporting UTF-8 text from Excel and I want to read and parse incoming data using Python. I read all the online information, so I already tried this, for example:
txtFile = codecs.open( 'halout.txt', 'r', 'utf-8' )
for line in txtFile:
print repr( line )
The error I am getting is:
UnicodeDecodeError: codec 'utf8' cannot decode byte 0xff at position 0: unexpected byte code
Looking at the text file in the Hex editor, I also tried the first FFFE values:
txtFile.seek( 2 )
right after "open", but it just causes a different error.
source
share