[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
setlocale of "POSIX" on Windows
From: |
Bruno Haible |
Subject: |
setlocale of "POSIX" on Windows |
Date: |
Fri, 21 Apr 2017 15:42:20 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-72-generic; KDE/5.18.0; x86_64; ; ) |
test-mbrtowc5.sh fails on native Windows: The mingw or MSVC setlocale()
understands the special locale name "C", but not the special locale name
"POSIX". This fixes it.
2017-04-21 Bruno Haible <address@hidden>
Fix test-mbrtowc5.sh failure on native Windows.
* lib/setlocale.c (setlocale_unixlike): Accept "POSIX" as an alias for
"C".
diff --git a/lib/setlocale.c b/lib/setlocale.c
index af8cc90..d2f203e 100644
--- a/lib/setlocale.c
+++ b/lib/setlocale.c
@@ -633,6 +633,13 @@ setlocale_unixlike (int category, const char *locale)
char ll_buf[64];
char CC_buf[64];
+ /* The native Windows implementation of setlocale understands the special
+ locale name "C", but not "POSIX". Therefore map "POSIX" to "C". */
+#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+ if (locale != NULL && strcmp (locale, "POSIX") == 0)
+ locale = "C";
+#endif
+
/* First, try setlocale with the original argument unchanged. */
result = setlocale (category, locale);
if (result != NULL)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- setlocale of "POSIX" on Windows,
Bruno Haible <=