Update common.cpp

This commit is contained in:
CRGBS 2023-05-24 14:28:35 +08:00 committed by GitHub
parent d973514da5
commit 943e5471cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
// 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");
}
#else
// POSIX-specific console initialization