This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "C" character set (again)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]