Am Montag, 16. Oktober 2017 um 01:43:48, schrieb Uwe Stöhr <uwesto...@web.de> > El 15.10.2017 a las 23:07, Kornel Benko escribió: > > > As I think I proposed in the attached part in other mail. > > > > Essentially, there is the change of > > open(file) > > to > > codecs.open(file, 'r', 'UTF-8') > > Thanks Kornel, > > unfortunately this does not work. Changing in ReplaceValues.py > > for line in open(InFile) > > into > > for line in codecs.open(InFile, 'r', 'UTF-8'): > > still gives me: > > File "C:\Program Files (x86)\Python35-32\lib\encodings\cp1252.py", > line 19, in encode return > codecs.charmap_encode(input,self.errors,encoding_table)[0] > UnicodeEncodeError: 'charmap' codec can't encode character '\u014d' > in position 1: character maps to <undefined> > > regards Uwe >
Ok, we are a step further. Input is now OK, but on output (the following print statement) the conversion from UTF-8 to cp1252 makes problems. Please replace the print statement print(SubstituteDataInLine(line[:-1])) with sys.stdout.write(SubstituteDataInLine(line[:-1])+'\n') Kornel
signature.asc
Description: This is a digitally signed message part.