mirror of
https://github.com/aristocratos/btop.git
synced 2024-06-14 16:34:39 +12:00
Check LC_CTYPE to set UTF-8 locale
Fix aristocratos/btop#752 Signed-off-by: Laurent Cheylus <foxy@free.fr>
This commit is contained in:
parent
edcb68cbb9
commit
f2ead3d3a9
|
@ -920,7 +920,7 @@ int main(int argc, char **argv) {
|
||||||
else {
|
else {
|
||||||
string found;
|
string found;
|
||||||
bool set_failure{};
|
bool set_failure{};
|
||||||
for (const auto loc_env : array{"LANG", "LC_ALL"}) {
|
for (const auto loc_env : array{"LANG", "LC_ALL", "LC_CTYPE"}) {
|
||||||
if (std::getenv(loc_env) != nullptr and str_to_upper(s_replace((string)std::getenv(loc_env), "-", "")).ends_with("UTF8")) {
|
if (std::getenv(loc_env) != nullptr and str_to_upper(s_replace((string)std::getenv(loc_env), "-", "")).ends_with("UTF8")) {
|
||||||
found = std::getenv(loc_env);
|
found = std::getenv(loc_env);
|
||||||
if (std::setlocale(LC_ALL, found.c_str()) == nullptr) {
|
if (std::setlocale(LC_ALL, found.c_str()) == nullptr) {
|
||||||
|
|
Loading…
Reference in a new issue