fix getwchar failing when LC_ALL undefined
This commit is contained in:
parent
f3b25e4043
commit
9eab8b69dd
1 changed files with 10 additions and 1 deletions
|
@ -111,7 +111,16 @@ namespace console {
|
|||
}
|
||||
}
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
auto locale = setlocale(LC_ALL, "");
|
||||
auto lang = getenv("LANG");
|
||||
|
||||
if (locale == nullptr) {
|
||||
if (lang != nullptr) {
|
||||
setlocale(LC_ALL, lang);
|
||||
} else{
|
||||
setlocale(LC_ALL, "C.UTF-8");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue