summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraristocratos <gnmjpl@gmail.com>2021-09-28 13:08:45 +0200
committeraristocratos <gnmjpl@gmail.com>2021-09-28 13:08:45 +0200
commit8296c1a8d560081e78b03843d3053a8510534d20 (patch)
treee79ce554c31c62ed7baaae929aa8bd3ac7fc8650
parentdc914aa86de91b59e05ad09883e2c9073b6bef5c (diff)
Changed: UTF8 detection search if LANG is set but fails to set
-rw-r--r--src/btop.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/btop.cpp b/src/btop.cpp
index 84e8a97..4f69977 100644
--- a/src/btop.cpp
+++ b/src/btop.cpp
@@ -713,10 +713,8 @@ int main(int argc, char **argv) {
//? Try to find and set a UTF-8 locale
if (bool found = false; std::setlocale(LC_ALL, NULL) == NULL or not str_to_upper(s_replace((string)std::setlocale(LC_ALL, NULL), "-", "")).ends_with("UTF8")) {
- if (std::getenv("LANG") != NULL and str_to_upper(s_replace((string)std::getenv("LANG"), "-", "")).ends_with("UTF8")) {
- if (std::setlocale(LC_ALL, std::getenv("LANG")) != NULL) {
- found = true;
- }
+ if (std::getenv("LANG") != NULL and str_to_upper(s_replace((string)std::getenv("LANG"), "-", "")).ends_with("UTF8") and std::setlocale(LC_ALL, std::getenv("LANG")) != NULL) {
+ found = true;
}
else {
if (setenv("LANG", "", 1) == 0) {