This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Handling numbers input/output in glibc
On Sat, 10 Jan 2004, Ulrich Drepper wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Behdad Esfahbod wrote:
>
> > By the way, I guess it has been a misunderstanding of the C99
> > standard, as I cannot verify that:
> >
> > C99 section 7.4.1.5 "The isdigit function" paragraph 2 says:
> > "The isdigit function tests for any decimal-digit character (as
> > defined in 5.2.1)".
> >
> > But in section 5.2.1, it defines the source and execution
> > character sets, and divides each into two sets: base character
> > set, whose contents are given by that subclause, and a set of
> > zero or more locale-specific members (which are not members of
> > the basic character set) called extended characters. It requires
> > the characters in basic set to be represented by one byte, but
> > not for extended characters. So I cannot see where it forbids us
> > to classify non-ASCII number characters as digits.
> >
> > Proposed fix should be trivial. This magically enables everyone
> > to enter numbers in their own local digits, Wow!
>
> I don't have to read more than this: isdigit() is defined to accept the
> ASCII decimal digits. That's it. There won't be any change.
>
> No, the standard isn't friendly to what you want to do but too much code
> depends on the existing behavior.
I understand this. But an small follow up: Does it mean the
same about iswdigit()? I ask this because the only way I found
that scanf("%Id",...) can parse non-ASCII digits is to define
them as "digit" in locale definition, which means iswdigit()
would return true for them.
behdad