简体   繁体   中英

Fix Unicode Decode Error Without Specifying Encoding='UTF-8'

I am getting the following error:

'ascii' codec can't decode byte 0xf4 in position 560: ordinal not in range(128)

I find this very weird given that my .csv file doesn't have special characters. Perhaps it has special characters that specify header rows and what not, idk.

But the main problem is that I don't actually have access to the source code that reads in the file, so I cannot simply add the keyword argument encoding='UTF-8' . I need to figure out which encoding is compatible with codecs.ascii_decode(...) . I DO have access to the .csv file that I'm trying to read, and I can adjust the encoding to that, but not the source file that reads it.

I have already tried exporting my .csv file into Western (ASCII) and Unicode (UTF-8) formats, but neither of those worked.

Fixed. Had nothing to do with unicode shenanigans, my script was writing a parquet file when my Cloud Formation Template was expecting a csv file. Thanks for the help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM