tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Proposal: _ctype_ table bitwidth change



On Tue, Mar 22, 2011 at 04:35:10AM +0900, Takehiko NOZAKI wrote:
> > As I wrote earlier, IMO the correct approach is to make the rune table
> > the public interface. Drop the current _CTYPE_* macros for anything but
> > legacy purposes. Drop them completely after the next major bump.
> > chrtbl is dead already and I plan to remove the rest of the libc code
> > soonish, it just complicated this without any real gain.
> >
> 
> no, _ctype_(for is*) and rune(for isw*) *must* be separated, example:
> 
> #include <ctype.h>
> #include <locale.h>
> #include <stdio.h>
> #include <wchar.h>
> #include <wctype.h>
> 
> int
> main(void)
> {
>         setlocale(LC_ALL, "en_US.UTF-8");
>         printf("isspace:%d\n", isspace((unsigned char)0xA0));
>         printf("iswspace:%d\n", iswspace((wchar_t)0xA0));
> }
> 
> this code print:
> 
> isspace:0
> iswspace:1
> 
> apparently ctype table and wctype table *differ*.

Yes, but that doesn't mean they can't use the same format. The problem
in this case is that 0xa0 is not a valid UTF8 sequence by itself.

Joerg


Home | Main Index | Thread Index | Old Index