* libc/locale/locale.c (lc_ctype_charset): Set to "UTF-8" on Cygwin.

(lc_message_charset): Ditto.
	(loadlocale): Set charset of the "C" locale to "UTF-8" on Cygwin.
	* libc/stdlib/mbtowc_r.c (__mbtowc): Default to __utf8_mbtowc on
	Cygwin.
	* libc/stdlib/wctomb_r.c (__wctomb): Default to __utf8_wctomb on
	Cygwin.
This commit is contained in:
Corinna Vinschen 2009-09-27 12:21:16 +00:00
parent 7677a6b206
commit a58d484bcf
4 changed files with 27 additions and 0 deletions

View File

@ -1,3 +1,13 @@
2009-09-27 Corinna Vinschen <corinna@vinschen.de>
* libc/locale/locale.c (lc_ctype_charset): Set to "UTF-8" on Cygwin.
(lc_message_charset): Ditto.
(loadlocale): Set charset of the "C" locale to "UTF-8" on Cygwin.
* libc/stdlib/mbtowc_r.c (__mbtowc): Default to __utf8_mbtowc on
Cygwin.
* libc/stdlib/wctomb_r.c (__wctomb): Default to __utf8_wctomb on
Cygwin.
2009-09-26 Eric Blake <ebb9@byu.net>
* libc/include/sys/unistd.h (execvpe, fexecve) [__CYGWIN__]:

View File

@ -225,8 +225,13 @@ static const char *__get_locale_env(struct _reent *, int);
#endif
#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 int lc_ctype_cjk_lang = 0;
char *
@ -428,7 +433,11 @@ loadlocale(struct _reent *p, int category)
if (!strcmp (locale, "POSIX"))
strcpy (locale, "C");
if (!strcmp (locale, "C")) /* Default "C" locale */
#ifdef __CYGWIN__
strcpy (charset, "UTF-8");
#else
strcpy (charset, "ASCII");
#endif
else if (locale[0] == 'C' && locale[1] == '-') /* Old newlib style */
strcpy (charset, locale + 2);
else /* POSIX style */

View File

@ -9,7 +9,11 @@
int (*__mbtowc) (struct _reent *, wchar_t *, const char *, size_t,
const char *, mbstate_t *)
#ifdef __CYGWIN__
= __utf8_mbtowc;
#else
= __ascii_mbtowc;
#endif
int
_DEFUN (_mbtowc_r, (r, pwc, s, n, state),

View File

@ -8,7 +8,11 @@
int (*__wctomb) (struct _reent *, char *, wchar_t, const char *charset,
mbstate_t *)
#ifdef __CYGWIN__
= __utf8_wctomb;
#else
= __ascii_wctomb;
#endif
int
_DEFUN (_wctomb_r, (r, s, wchar, state),