Paul Eggert <[EMAIL PROTECTED]> writes:

> That would work for now, but it won't work if wget got properly
> internationalized.  That is because isdigit(x) succeeds for
> non-ASCII digits in some locales.  Some locales have multiple ways
> to represent the decimal digits, and some locales even have
> non-decimal digits.

It will still work, because Wget doesn't call setlocale() with
LC_CTYPE.  Therefore it is, as far as is* macros are concerned, in C
locale.

Not setting the locale for characters is an intentional decision,
brought because Wget reads data from the web, so the current locale
setting are pretty much irrelevant (and are potentially harmful) for
its operation.

> It's best to use isdigit only when one wants _all_ the characters
> that are digits, not just '0' through '9'.  If you just want '0'
> through '9', then you should use the test '0' <= x && x <= '9'; this
> code is guaranteed to work in all locales.

In the general case (other is* macros), such hacked-up code is
probably slower than table lookups.

That's why Wget 1.7 incorporates its own implementation of IS* macros
(from Gcc) and uses them consistently.  Except in snprintf.c, which is
not part of Wget proper.  *sigh*

Reply via email to