From 6e16da9dec940886d173af96c83935dc4431ba5c Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 4 May 2011 08:45:17 +0000 Subject: [PATCH] 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. --- newlib/ChangeLog | 7 +++++++ newlib/libc/locale/locale.c | 13 ++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index b96c40a43..3c1f84b39 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,10 @@ +2011-05-04 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. + 2011-05-02 Yaakov Selkowitz * libc/include/sys/features.h [__CYGWIN__] (_POSIX_SPIN_LOCKS): Define. diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index 37ac5e947..9f9b63962 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -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