MinLL / GameInterfaceForToys

Scripts to control toys for Skyrim and other games.
29 stars 8 forks source link

Open with utf-8 encoding #7

Closed zoollcar closed 1 year ago

zoollcar commented 1 year ago

Chinese windows system cmd uses gbk encoding by default, Skyrim uses utf-8 encoding, which causes file reading to fail

The same should happen in Japanese or other East Asian regions

[GameInterfaceForToys] [-] Unhandled Exception (<class 'UnicodeDecodeError'>): 'gbk' codec can't decode byte 0xa0 in position 57: illegal multibyte sequence
Traceback (most recent call last):
  File "C:\Users\zoollcar\Desktop\GameInterfaceForToys\GameInterfaceForToys.py", line 505, in main
    await run_task(ssi.parse_log(), run_async=True)
                   ^^^^^^^^^^^^^^^
  File "C:\Users\zoollcar\Desktop\GameInterfaceForToys\GameInterfaceForToys.py", line 407, in parse_log
    raise e
  File "C:\Users\zoollcar\Desktop\GameInterfaceForToys\GameInterfaceForToys.py", line 389, in parse_log
    line = fd.readline()
           ^^^^^^^^^^^^^