-
Notifications
You must be signed in to change notification settings - Fork 11.4k
fix some unicode prob #1584
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
fix some unicode prob #1584
Conversation
ignore build.yml it just for test some item |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In summary, try setting your locale like this instead:
export LANG=zh_CN.UTF-8
@@ -522,6 +522,11 @@ void console_init(console_state & con_st) { | |||
// Turn off ICANON (ENABLE_LINE_INPUT) and ECHO (ENABLE_ECHO_INPUT) | |||
dwMode &= ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT); | |||
SetConsoleMode(hConIn, dwMode); | |||
}else{ | |||
// Set console input codepage to UTF8 | |||
_setmode(_fileno(stdin), _O_U8TEXT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary when your configured locale has "UTF-8" in it?
// Set console input codepage to UTF8 | ||
_setmode(_fileno(stdin), _O_U8TEXT); | ||
// Set locale to Chinese Simplified UTF-8 | ||
setlocale(LC_ALL, "zh-CN.UTF-8"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sets everyone to Chinese. When someone doesn't have "zh_CN.UTF-8" installed on their system, it will instead set to "C", which breaks Unicode support for them.
What we already have:
setlocale(LC_ALL, "");
When setlocale
is used with an empty string, it uses your system locale settings. In Linux you can set it like this:
export LANG=zh_CN.UTF-8
See this post at Stack Overflow for more information.
i am use windows 10 os maybe this pr is not good for here |
make it support chinese more