KiField icon indicating copy to clipboard operation
KiField copied to clipboard

UnicodeDecodeError: 'gbk' codec can't decode byte 0xa8 in position 1144: illegal multibyte sequence

Open lyrain2009 opened this issue 2 years ago • 4 comments

Screenshots image Desktop (please complete the following information):

  • OS [Win11]
  • Python version python3.8
  • KiField version [1.0.1]

lyrain2009 avatar Dec 01 '23 02:12 lyrain2009

Kicad info: Kicad Application: KiCad x64 on x64 Version: 7.0.9, release build

lyrain2009 avatar Dec 01 '23 02:12 lyrain2009

image add encoding='utf-8', problem solved

lyrain2009 avatar Dec 01 '23 03:12 lyrain2009

Since you've identified the problem and have a potential fix, why not just issue a pull request?

devbisme avatar Dec 01 '23 21:12 devbisme

Since you've identified the problem and have a potential fix, why not just issue a pull request? Thanks.

I find it's not a good ideal to modify source file,because all the open function in source shoud be added "encoding='utf-8' ".

the reason of UnicodeDecodeError is the system encoding method,because when python open file,it use system default encoding. I use windows in china,the default encoding is 'gbk',so when python open file ,it use 'gbk' codec to decode utf-8 file that cause error. So the solution is set Python to utf-8 mode,just set the PYTHONUTF8=1 environment variable,no need to modify source file. Python: Use the UTF-8 mode on Windows!

lyrain2009 avatar Dec 05 '23 02:12 lyrain2009