develooper Front page | perl.perl5.porters | Postings from January 2001

Re: 8482 busted for $^V sprintf()s on OS/390

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
January 21, 2001 05:24
Subject:
Re: 8482 busted for $^V sprintf()s on OS/390
Message ID:
20010121132413.C34449@plum.flirble.org
On Sun, Jan 21, 2001 at 01:34:05PM +0000, Hugo wrote:
>         while (isDIGIT(*s))
>             count = count * 10 + (*s++ - '0');
> .. which (I think) does the right thing with and without UTF8 under
> ASCII, and with straight EBCDIC, but not with UTF8-encoded EBCDIC.
> Similarly, we dump digits in sprintf without regard to utf8ness.
> 
> Attached patch should at least avoid setting the UTF8 flag in the
> above example. (Note that the namechange 'utf' to 'vec_utf' is
> cosmetic only.)

Hmm. This means that isDIGIT should be used only with care:

from handy.h

#define isDIGIT(c)      ((c) >= '0' && (c) <= '9')
#ifdef EBCDIC
    /* In EBCDIC we do not do locales: therefore() isupper() is fine. */

[followed by EBCDIC specific things]

and we need to use isDIGIT_uni on any UTF8 string.
But will that spot digits other than 0 to 9?

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About