fixed: when non ASCII character in .profile on CJK Windows#125
Open
ncaq wants to merge 1 commit intoOpticos:masterfrom
Open
fixed: when non ASCII character in .profile on CJK Windows#125ncaq wants to merge 1 commit intoOpticos:masterfrom
ncaq wants to merge 1 commit intoOpticos:masterfrom
Conversation
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.
Member
|
Thanks for the PR. I will test it in a bit, but I have a quick question since I can't get to it immediately. When the process runs, does it spawn a black cmd window? |
Author
|
I hadn't taken that into account. |
Member
|
It's not a problem. Pr's are good. I am thinking there has got to be a way to decode stuff properly with the current system. I'll look into it if you want. Thanks again, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I use GWSL.
And, I got error.
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.