I have a file (downloaded from somewhere on the www) that is encoded in CP819, and want to read it then further handle the data in UTF-8. Tried all the examples I could find here and elsewhere, nothing worked.
The furthest I could get:
with codecs.open(INFIL, mode='rb',encoding='cp819') as INPUT:
DUMMY=INPUT.readline()
print (DUMMY)
which gave me
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in position 5: ordinal not in range(128)
At offset 5 in the input file is the first character above ascii 128: the \xe8 is supposed to decode to 'è'.
Found a few pages concerning this error message, tried all suggestions I found, nothing helps.
Using python 2.7.6 on Ubuntu 14.04.1 LTS