-
Notifications
You must be signed in to change notification settings - Fork 51
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
[Report] default encoding issue for other character set #227
Comments
Welcome to this project and thank you!' first issue |
Fix this fralau#227 This commit is to set the encoding when open a file. It's useful for other characters set users.
I did a quick test by opening a >>> f = open('gbk.crlf.txt', 'r', encoding='utf-8')
>>> f
<_io.TextIOWrapper name='gbk.crlf.txt' mode='r' encoding='utf-8'>
>>> f.read()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xab in position 0: invalid start byte Here is the sample file I used, with characters from the https://raw.githubusercontent.com/x1angli/cvt2utf/master/sample_data/gbk.crlf.txt There is a proposed fix in PR #228 that enforces the encoding to I am using Python 3.12.3. |
I am a developer from China. And My develop environment is Win11. When I trying using mkdocs and this macros-plugin, I find a issue. The command reports that the encoding= 'cp936'. First, I think it may be the defalut set by the CMD or PowerShell, but I change it and this doesn't work. Then I check the report, and find the following message (Other message is omitted for simplify):
The root cause is the 'gbk' encoding. However, the first trace shows that this is because mkdocs-macros-plugin open the file without setting the utf-8 encoding.
The text was updated successfully, but these errors were encountered: