This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: "C" character set (again)
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin-developers at cygwin dot com
- Date: Sun, 10 Jan 2010 15:13:52 +0100
- Subject: Re: "C" character set (again)
- References: <416096c60912282254r7230cbaeiad6b3432f7c15257@mail.gmail.com> <20100110140102.GD28315@calimero.vinschen.de>
- Reply-to: cygwin-developers at cygwin dot com
On Jan 10 15:01, Corinna Vinschen wrote:
> On Dec 29 06:54, Andy Koppe wrote:
> > What would be required to do this, beyond removing the following
> > special casing in newlib?
> > [...]
> > --- newlib/libc/locale/locale.c 9 Oct 2009 08:25:28 -0000 1.29
> > +++ newlib/libc/locale/locale.c 29 Dec 2009 06:47:57 -0000
> > @@ -242,13 +242,8 @@ static const char *__get_locale_env(stru
> >
> > #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 *
> > @@ -450,11 +445,7 @@ loadlocale(struct _reent *p, int categor
> > 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 */
> > || locale[1] == '.')) /* Extension for the C locale to allow
>
> Was that the only change you applied? Are you aware that this also
> requires to revert the changes to libc/stdlib/mbtowc_r.c and
> libc/stdlib/wctomb_r.c which set the function pointers __mbtowc to
> __utf8_mbtowc and __wctomb to __utf8_wctomb on Cygwin? If you do
> that, does still everything work as you expect?
Boy, that's tricky. If this change gets reverted, the initial
environment is converted to ASCII, rather than UTF-8. This very change
was what allowed to remove the special code to fetch the LC_xxx vars
from the Windows environment before converting the environment.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat