diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2009-09-27 16:21:16 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2009-09-27 16:21:16 +0400 |
commit | a58d484bcfa8a8581fda771e2f60aa0307534590 (patch) | |
tree | e41c24a615f73ed496d51f89d71c44df612ccf08 /newlib | |
parent | 7677a6b206265ca4dde7b93a04b15f602fcac0af (diff) |
* 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.
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 10 | ||||
-rw-r--r-- | newlib/libc/locale/locale.c | 9 | ||||
-rw-r--r-- | newlib/libc/stdlib/mbtowc_r.c | 4 | ||||
-rw-r--r-- | newlib/libc/stdlib/wctomb_r.c | 4 |
4 files changed, 27 insertions, 0 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 68706f9ef..5202b89b0 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -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__]: diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index ef7a7e428..584e5d8f4 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -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 */ diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c index 4e80c51b1..a791692be 100644 --- a/newlib/libc/stdlib/mbtowc_r.c +++ b/newlib/libc/stdlib/mbtowc_r.c @@ -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), diff --git a/newlib/libc/stdlib/wctomb_r.c b/newlib/libc/stdlib/wctomb_r.c index 95a04069c..207221a7e 100644 --- a/newlib/libc/stdlib/wctomb_r.c +++ b/newlib/libc/stdlib/wctomb_r.c @@ -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), |