From 7be55ef26c553a1275bd057d19cb261bf24dea58 Mon Sep 17 00:00:00 2001 From: Ivan Sorokin Date: Tue, 21 Jan 2025 23:42:17 +0300 Subject: [PATCH] do not break things if locale is not installed --- CPP/7zip/Archive/Zip/ZipItem.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CPP/7zip/Archive/Zip/ZipItem.cpp b/CPP/7zip/Archive/Zip/ZipItem.cpp index 7a99fad..b3c9a8c 100644 --- a/CPP/7zip/Archive/Zip/ZipItem.cpp +++ b/CPP/7zip/Archive/Zip/ZipItem.cpp @@ -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