From 4f4bbf1d7ddb94774c35ce85b1c011c86bd4dd7c Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Mon, 24 Dec 2012 08:00:49 +0900 Subject: [PATCH] localecharset: respect the thread-specific locale on Mac OS X --- gettext-runtime/intl/ChangeLog | 6 ++++++ gettext-runtime/intl/localcharset.c | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index 5a4066bb2..857cbeb2a 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,9 @@ +2012-12-20 Daiki Ueno + + 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 Fix W64 build errors. diff --git a/gettext-runtime/intl/localcharset.c b/gettext-runtime/intl/localcharset.c index cd8d507e1..670b8e6cb 100644 --- a/gettext-runtime/intl/localcharset.c +++ b/gettext-runtime/intl/localcharset.c @@ -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 @@ -65,6 +65,11 @@ # include #endif +/* For MB_CUR_MAX_L */ +#if defined DARWIN7 +# include +#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 -- 2.47.2