]> Savannah Git Hosting - gnulib.git/commitdiff
localcharset: Support the UTF-8 environment on native Windows.
authorBruno Haible <bruno@clisp.org>
Mon, 23 Dec 2024 15:56:15 +0000 (16:56 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 23 Dec 2024 15:56:15 +0000 (16:56 +0100)
* lib/localcharset.c (locale_charset): Recognize also the special case
of a setlocale() result that ends in ".UTF-8".

ChangeLog
lib/localcharset.c

index c2948988288000fec333d02fc74333e73dd9244b..1ac323da3e85d5a645002fe0b7c2770a800f757d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-12-23  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        setlocale tests: Add unit test for LC_MESSAGES handling.
index bd3367477de85875b72d7cd67239e7e8ee9b3e4e..755645763d2bbfeacd595f14588636b8d9749a6c 100644 (file)
@@ -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
     {