From 1ad52242273e4cc7161a2211ff9fca0e80655290 Mon Sep 17 00:00:00 2001 From: staviq Date: Fri, 20 Oct 2023 04:16:49 +0200 Subject: [PATCH] fix non-utf locale 2 --- common/console.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/console.cpp b/common/console.cpp index 6046b1bfa..f3b6ec54b 100644 --- a/common/console.cpp +++ b/common/console.cpp @@ -113,10 +113,10 @@ namespace console { } auto locale = setlocale(LC_ALL, ""); - auto lang = getenv("LANG"); - if (locale == nullptr) { - if (lang != nullptr && strcmp(lang, "C") && strcasestr(lang, "utf-8")) { + if (locale == nullptr || !strcmp(locale, "C") || strcasestr(locale, "utf-8") == nullptr) { + auto lang = getenv("LANG"); + if (lang != nullptr && strcmp(lang, "C") && strcasestr(lang, "utf-8") != nullptr) { setlocale(LC_ALL, lang); } else{ setlocale(LC_ALL, "C.UTF-8");