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

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -