It's called
So usually should
Try in a
chardetect
on Windows,when used from command line.E:\div_code λ chardetect my.csv my.csv: ascii with confidence 1.0Not sure if that would help on this problem.
Quote:UnicodeEncodeError: 'latin-1' codec can't encode character '\ufeff' in position
\ufeff
indicate that this file is saved with BOM(Byte order mark).So usually should
encoding='utf-8-sig'
fix this.>>> f = open('file', mode='r') >>> f.read() '\ufefftest' >>> f = open('file', mode='r', encoding='utf-8-sig') >>> f.read() 'test'Not sure when you say Asia version of Windows that this happen on,what version of Python
Try in a
errors='replace'
in open to see what is replace,there is also errors="ignore"
open ("1.txt", "r", encoding="utf-8-sig", errors='replace')