mirror of
https://github.com/aristocratos/btop.git
synced 2024-09-29 14:41:36 +02:00
Fixed: Check that getenv("LANG") is not NULL in UTF-8 check
This commit is contained in:
parent
bc0c109e5e
commit
1f5aebead0
@ -719,9 +719,9 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
//? Try to find and set a UTF-8 locale
|
//? Try to find and set a UTF-8 locale
|
||||||
if (bool found = false; not str_to_upper(s_replace((string)std::setlocale(LC_ALL, NULL), "-", "")).ends_with("UTF8")) {
|
if (bool found = false; not str_to_upper(s_replace((string)std::setlocale(LC_ALL, NULL), "-", "")).ends_with("UTF8")) {
|
||||||
if (const string lang = (string)getenv("LANG"); str_to_upper(s_replace(lang, "-", "")).ends_with("UTF8")) {
|
if (getenv("LANG") != NULL and str_to_upper(s_replace((string)getenv("LANG"), "-", "")).ends_with("UTF8")) {
|
||||||
found = true;
|
found = true;
|
||||||
std::setlocale(LC_ALL, lang.c_str());
|
std::setlocale(LC_ALL, getenv("LANG"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setenv("LANG", "", 1);
|
setenv("LANG", "", 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user