Hacker News new | ask | show | jobs
by ars 4779 days ago
Is that actually a good thing? If I'm using \d to validate numbers (for example to check before string to int conversion, or IP address, phone number, or any other use), other unicode digits are not helpful to me.

It's great to support unicode, but I don't think the \d should have been extended this way. Add a \ud or something.

4 comments

Given that the category is specifically "decimal digit", I think it's good, so long as the number parsing code accepts them all too.
Yes. Assuming that, it's good. I think that assumption is likely to be invalid in many cases, though.
Yes it's a good thing. There are other places in the world that don't just use ascii. If you want European style numbers just use [0-9]
If you use a preg engine you can add the /a modifier which excludes unicode chars from matches.
Maybe specify the subset of unicode you're expecting in the headers, and have the compiler do the nitty gritty?