Trying to translate UTF or Unicode file that contains Chinese characters

17 views
Skip to first unread message

stephenh...@u.northwestern.edu

unread,
Jun 17, 2016, 4:55:44 PM6/17/16
to Google API Python Client
I am trying to decode a txt file using
 
q= [line.rstrip() for line in open('Chinese_Names_Test')]

but I receive this

UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 47: character maps to <undefined>



I realize the error comes because the Decoder is using cp1252 but how can I do this in UTF or Unicode? I have to save the txt file in UTF or Unicode to keep the Chinese Characters.  Many thanks.






Reply all
Reply to author
Forward
0 new messages