Cygwin-specific patch from Andy Koppe:

* libc/locale/locale.c (current_categories): On Cygwin, set LC_CTYPE
	to C.UTF-8 to match initial __wctomb and __mbtowc settings.
	(lc_ctype_charset): On Cygwin, initialize to "UTF-8".
	(loadlocale): Remove unused Cygwin-specifc code.
This commit is contained in:
Corinna Vinschen 2011-05-04 08:45:17 +00:00
parent aa8097021e
commit 6e16da9dec
2 changed files with 13 additions and 7 deletions

View File

@ -1,3 +1,10 @@
2011-05-04 Andy Koppe <andy.koppe@gmail.com>
* libc/locale/locale.c (current_categories): On Cygwin, set LC_CTYPE
to C.UTF-8 to match initial __wctomb and __mbtowc settings.
(lc_ctype_charset): On Cygwin, initialize to "UTF-8".
(loadlocale): Remove unused Cygwin-specifc code.
2011-05-02 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* libc/include/sys/features.h [__CYGWIN__] (_POSIX_SPIN_LOCKS): Define.

View File

@ -235,7 +235,11 @@ char __default_locale[ENCODING_LEN + 1] = DEFAULT_LOCALE;
static char current_categories[_LC_LAST][ENCODING_LEN + 1] = {
"C",
"C",
#ifdef __CYGWIN__ /* Cygwin starts with LC_CTYPE set to "C.UTF-8". */
"C.UTF-8",
#else
"C",
#endif
"C",
"C",
"C",
@ -255,13 +259,12 @@ static const char *__get_locale_env(struct _reent *, int);
#endif /* _MB_CAPABLE */
#if 0 /*def __CYGWIN__ TODO: temporarily(?) disable C == UTF-8 */
#ifdef __CYGWIN__
static char lc_ctype_charset[ENCODING_LEN + 1] = "UTF-8";
static char lc_message_charset[ENCODING_LEN + 1] = "UTF-8";
#else
static char lc_ctype_charset[ENCODING_LEN + 1] = "ASCII";
static char lc_message_charset[ENCODING_LEN + 1] = "ASCII";
#endif
static char lc_message_charset[ENCODING_LEN + 1] = "ASCII";
static int lc_ctype_cjk_lang = 0;
char *
@ -495,11 +498,7 @@ restart:
if (!strcmp (locale, "POSIX"))
strcpy (locale, "C");
if (!strcmp (locale, "C")) /* Default "C" locale */
#if 0 /*def __CYGWIN__ TODO: temporarily(?) disable C == UTF-8 */
strcpy (charset, "UTF-8");
#else
strcpy (charset, "ASCII");
#endif
else if (locale[0] == 'C'
&& (locale[1] == '-' /* Old newlib style */
|| locale[1] == '.')) /* Extension for the C locale to allow