Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed: when non ASCII character in .profile on CJK Windows #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jan 25, 2022

  1. fixed: when non ASCII character in .profile on CJK Windows

    I use GWSL.
    And, I got error.
    
    ~~~console
    2021-12-07 00:57:32,949 - GWSL 1.4.0 - ERROR - Exception occurred - Error in Mainloop
    Traceback (most recent call last):
      File "manager.py", line 4451, in <module>
      File "manager.py", line 4061, in draw
      File "manager.py", line 4014, in apper
      File "manager.py", line 2266, in app_launcher
      File "manager.py", line 2805, in spawn_n_run
      File "wsl_tools.py", line 191, in profile
    UnicodeDecodeError: 'cp932' codec can't decode byte 0x86 in position 586: illegal multibyte sequence
    ~~~
    
    I research.
    
    I found the cause of this error to be the following.
    
    In Japanese Windows, the default system character set is cp932 (Shift_JIS).
    Therefore, Python also basically tries to handle strings as cp932.
    However, in GNU/Linux, the character encoding of files is basically ASCII or UTF-8.
    At least, it will be more than cp932.
    Therefore, when reading `.profile', it is better to expect UTF-8 and read it with a higher success rate.
    Therefore, I basically rewrote the wsl.exe process to assume that the return value of the process is UTF-8 and decode it.
    ncaq committed Jan 25, 2022
    Configuration menu
    Copy the full SHA
    dd16a4f View commit details
    Browse the repository at this point in the history