do not break things if locale is not installed

This commit is contained in:
Ivan Sorokin 2025-01-21 23:42:17 +03:00
parent 299982cc8d
commit 7be55ef26c

View file

@ -558,6 +558,9 @@ void CItem::GetUnicodeString(UString &res, const AString &s, bool isComment, boo
// Detect required code page name from current locale
char *lc = setlocale(LC_CTYPE, "");
if (!lc || !lc[0]) {
lc = getenv("LC_CTYPE");
}
if (lc && lc[0]) {
// Compare up to the dot, if it exists, e.g. en_US.UTF-8