+2019-07-02 Bruno Haible <bruno@clisp.org>
+
+ localcharset, nl_langinfo: Fix return value for UTF-8 locales on MSVC.
+ * lib/localcharset.c (locale_charset): Return "UTF-8" instead of
+ "CPutf8".
+ * lib/nl_langinfo.c (ctype_codeset): Likewise.
+
2019-07-02 Bruno Haible <bruno@clisp.org>
getcwd: Fix crash when invoked with size = 0 on MSVC.
encoding is the best bet. */
sprintf (buf, "CP%u", GetACP ());
}
- codeset = buf;
+ /* 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)
+ codeset = "UTF-8";
+ else
+ codeset = buf;
# elif defined OS2
memmove (buf + 2, codeset, codesetlen + 1);
else
sprintf (buf + 2, "%u", GetACP ());
- codeset = memcpy (buf, "CP", 2);
-# endif
+ /* 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)
+ return "UTF-8";
+ else
+ return memcpy (buf, "CP", 2);
+# else
return codeset;
+#endif
}
#endif