Skip to content

Commit

Permalink
Changed: UTF8 detection search if LANG is set but fails to set
Browse files Browse the repository at this point in the history
  • Loading branch information
aristocratos committed Sep 28, 2021
1 parent dc914aa commit 8296c1a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/btop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8296c1a

Please sign in to comment.