Re: Unicode chars allowed in numbers?
| From: | Matt Wilmas | Date: | Fri, 10 Nov 2006 15:08:55 +0000 |
| Subject: | Re: Unicode chars allowed in numbers? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-26468@lists.php.net to get a copy of this message | ||
Hi Andrei,
All right, glad I checked. I had a few things in mind to optimize
is_numeric_string/unicode, and it's fairly straightforward in _string, but
would just make things slower if u_* functions were needed to do the same in
_unicode, so I was going to rethink it. Now whatever I come up with can be
easily copied to the _unicode version with just minor changes...
Thanks,
Matt
----- Original Message -----
From: "Andrei Zmievski"
Sent: Friday, November 10, 2006
> > Hi Andrei, et al.,
> >
> > I was just looking at README.UNICODE, regarding interpretation of
> > numbers:
> > "we restrict numbers to consist only of ASCII digits," and "Numeric
> > strings
> > are supposed to adhere to the same rules." Is it correct to take
> > that to
> > mean only UChar's with values from '0'-'9'/0x30-0x39 (and
> > 'a'-'z'
> > equivalents for bases > 10)?
>
> Correct.
>
> > I ask because in zend_u_strtol(), HANDLE_U_NUMERIC() for array
> > keys, etc.,
> > the u_digit() function is used, which also allows non-ASCII, higher-
> > value
> > digit characters, doesn't it? But then in is_numeric_unicode(), when
> > checking for hex numbers, the ASCII values '0' and 'x' are used,
> > which is
> > what I'd expect after reading README.UNICODE.
>
> You're correct here again, u_digit() should not be used there.
>
> -Andrei