python - Reading csv with unicodecsv: UnicodeDecodeError -
python - Reading csv with unicodecsv: UnicodeDecodeError -
i have these lines of code:
zf = zipfile.zipfile(self.temp_file, 'r') info = zf.open('myfile.csv', mode='r') result = [link link in unicodecsv.dictreader(data)] and here's exception code:
unicodedecodeerror: 'utf8' codec can't decode byte 0xc9 in position 13: invalid continuation byte input string is:
cafÉ restaurant so doing wrong , why unicodecsv can't handle utf-8?
it because input not utf-8, latin-1 (or similar). in utf-8, É encoded 2 bytes: '\xc3\x89'. error informs \xc9 byte met in input; És encoding in latin-1 or win-1252 codepages.
python csv unicode
Comments
Post a Comment