Fix #15407 - Fix using unexpected ACP for input on Windows (#15408)

This commit is contained in:
GustavoLCR 2019-11-04 03:36:20 -03:00 committed by Anton Kochkov
parent 31d6b5764a
commit 4716e50572

View File

@ -1465,10 +1465,13 @@ R_API void r_cons_set_utf8(bool b) {
r_sys_perror ("r_cons_set_utf8");
}
#if UNICODE
if (!SetConsoleCP (CP_UTF8)) {
UINT inCP = CP_UTF8;
#else
UINT inCP = GetACP ();
#endif
if (!SetConsoleCP (inCP)) {
r_sys_perror ("r_cons_set_utf8");
}
#endif
} else {
R_LOG_WARN ("UTF-8 Codepage not installed.\n");
}