Lone surrogates in UTF-8? (was: Re: Console codepage setting via chcp?)

Corinna Vinschen corinna-cygwin@cygwin.com
Sun Sep 27 09:00:00 GMT 2009


On Sep 27 10:55, Corinna Vinschen wrote:
> On Sep 27 09:33, Andy Koppe wrote:
> > >> The __utf8_wctomb function could just create the corresponding
> > >> UCS-2 values if no first half has been encountered before.  The
> > >> __utf8_mbtowc function could simply allow these UCS-2 values again.
> > >>
> > >> That works (I just tested it) and is a small change, but is it really
> > >> desirable to allow UCS-2 values in UTF-8 strings?
> > >
> > > I don't know.
> > 
> > Improved answer: Debian allows them!
> 
> Sure, just as almost any C library allows invalid UTF-8 5 and 6 byte
> sequences to be converted to and from wchar_t (if sizeof(wchar_t) is 4).

Oh and, btw., given that sizeof(wchar_t) is 4, glibc has of course no
reason to do any surrogate pair handling at all.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat



More information about the Cygwin-developers mailing list