Skip to content

fix(cli): force UTF-8 stdout/stderr on Windows to avoid UnicodeEncode… - #1

Open
2031814001yuyue-tech wants to merge 1 commit into
xiguawang:mainfrom
2031814001yuyue-tech:fix/windows-gbk-encoding
Open

fix(cli): force UTF-8 stdout/stderr on Windows to avoid UnicodeEncode…#1
2031814001yuyue-tech wants to merge 1 commit into
xiguawang:mainfrom
2031814001yuyue-tech:fix/windows-gbk-encoding

Conversation

@2031814001yuyue-tech

Copy link
Copy Markdown

Windows 终端默认使用 GBK/cp936 编码,无法编码所有 Unicode 字符。在中文 Windows 上读取文章时,会在打印结果时崩溃:

…Error

Windows consoles default to GBK/cp936 which cannot encode all Unicode
characters (e.g. \xa0 non-breaking spaces common in article bodies).
Reading a WeChat article on a Chinese Windows terminal previously
crashed with UnicodeEncodeError when printing the result.

Reconfigure stdout/stderr to UTF-8 at CLI entry, matching the UTF-8
encoding used when writing files via --output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant