From: Bruno Haible Date: Mon, 23 Dec 2024 15:56:15 +0000 (+0100) Subject: localcharset: Support the UTF-8 environment on native Windows. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=39a074e3b8a5c3a78d5161bd1cf3cc8a029864f5;p=gnulib.git localcharset: Support the UTF-8 environment on native Windows. * lib/localcharset.c (locale_charset): Recognize also the special case of a setlocale() result that ends in ".UTF-8". --- diff --git a/ChangeLog b/ChangeLog index 61440f9299..df9fe86df5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-12-23 Bruno Haible + + localcharset: Support the UTF-8 environment on native Windows. + * lib/localcharset.c (locale_charset): Recognize also the special case + of a setlocale() result that ends in ".UTF-8". + 2024-12-23 Bruno Haible setlocale: Handle LC_MESSAGES correctly on native Windows. diff --git a/lib/localcharset.c b/lib/localcharset.c index 93c4baa471..0245ea3576 100644 --- a/lib/localcharset.c +++ b/lib/localcharset.c @@ -939,8 +939,10 @@ locale_charset (void) sprintf (buf, "CP%u", GetACP ()); } /* For a locale name such as "French_France.65001", in Windows 10, - setlocale now returns "French_France.utf8" instead. */ - if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0) + setlocale now returns "French_France.utf8" instead, or in the UTF-8 + environment (with modern system settings) "fr_FR.UTF-8". */ + if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0 + || strcmp (buf + 2, "UTF-8") == 0) codeset = "UTF-8"; else {