Re: Re: PHP 5.2.1RC3 Released

From: Date: Thu, 25 Jan 2007 19:14:00 +0000
Subject: Re: Re: PHP 5.2.1RC3 Released
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14  Groups: php.internals 
Request: Send a blank email to internals+get-27663@lists.php.net to get a copy of this message
I've been thinking about how to not force UTF-8 in PCRE for PHP 6, and it's not that simple. This is mainly due to preg_replace(), because it allows array() parameters that can contain mixed IS_UNICODE and IS_STRING values. I hope you realize though, that in UTF-8 mode PCRE does not care about POSIX locales, even in PHP 5.
I haven't though on that, but can't you simply reject mixing of unicode and binary strings?
By the way, I think ICU regexp extension, when implemented, will let you match Portuguese characters in UTF-8 strings.
I wasn't aware of that API.. anyway it is probably slower than pcre+locales (because it uses unicode propertie table lookups)
Yes, UTF-8 covers many aspects but does it know about words, white spaces (not sure if ws are always the same) and other locale specific issues? generally, not only pcre. Maybe it is more something for ICU directly, as you said later in this thread.
That's not really a problem with pcre, as it supports unicode character properties. It isn't documented in phpdoc (don't look at me :P), but it looks like: \pL where L is one of (from http://pcre.org/pcre.txt):
        L     Letter
        Ll    Lower case letter
        N     Number
        Nd    Decimal number
        Nl    Letter number
        No    Other number
        P     Punctuation
        Zs    Space separator
(...) Nuno

« previous php.internals (#27663) next »