]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
localecharset: respect the thread-specific locale on Mac OS X
authorDaiki Ueno <ueno@gnu.org>
Sun, 23 Dec 2012 23:00:49 +0000 (08:00 +0900)
committerDaiki Ueno <ueno@gnu.org>
Mon, 24 Dec 2012 00:31:55 +0000 (09:31 +0900)
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/localcharset.c

index 5a4066bb29f4dc577a9238fcaf54c200aff4c15a..857cbeb2a4a8baeb8cb41c99e8f3af0913f00b6b 100644 (file)
@@ -1,3 +1,9 @@
+2012-12-20  Daiki Ueno  <ueno@gnu.org>
+
+       localecharset: respect the thread-specific locale on Mac OS X
+       * lib/localcharset.c (locale_charset) [DARWIN7]: Use MB_CUR_MAX_L
+       instead of MB_CUR_MAX.
+
 2012-12-21  Daiki Ueno  <ueno@gnu.org>
 
        Fix W64 build errors.
index cd8d507e168ed47b67fcf28d3bfd476cb34d7cc7..670b8e6cbdc95a287df11225ac9d6ec5bc03805f 100644 (file)
@@ -1,6 +1,6 @@
 /* Determine a canonical name for the current locale's character encoding.
 
-   Copyright (C) 2000-2006, 2008-2010 Free Software Foundation, Inc.
+   Copyright (C) 2000-2006, 2008-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
 # include <os2.h>
 #endif
 
+/* For MB_CUR_MAX_L */
+#if defined DARWIN7
+# include <xlocale.h>
+#endif
+
 #if ENABLE_RELOCATABLE
 # include "relocatable.h"
 #else
@@ -545,7 +550,7 @@ locale_charset (void)
 #ifdef DARWIN7
   /* Mac OS X sets MB_CUR_MAX to 1 when LC_ALL=C, and "UTF-8"
      (the default codeset) does not work when MB_CUR_MAX is 1.  */
-  if (strcmp (codeset, "UTF-8") == 0 && MB_CUR_MAX <= 1)
+  if (strcmp (codeset, "UTF-8") == 0 && MB_CUR_MAX_L (uselocale (NULL)) <= 1)
     codeset = "ASCII";
 #endif