#30382 [Asn->Bgs]: preg_match and utf-8
| From: | tony2001@php.net | Date: | Sat, 12 Feb 2005 21:00:28 +0000 |
| Subject: | #30382 [Asn->Bgs]: preg_match and utf-8 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-73953@lists.php.net to get a copy of this message | ||
ID: 30382
Updated by: tony2001@php.net
Reported By: TiloLutz at gmx dot de
-Status: Assigned
+Status: Bogus
Bug Type: PCRE related
Operating System: Suse Linux 9.1
PHP Version: 4.3.9
Assigned To: derick
New Comment:
PCRE has limited UTF-8 support.
"A class is matched against a UTF-8 character instead of just a
single byte, but it can match only characters whose values are less
than 256. Characters with greater values always fail to match a class."
(c) man pcre
No bug in PHP -> bogus.
Previous Comments:
------------------------------------------------------------------------
[2004-12-06 22:08:02] pmichaud at pobox dot com
It might help to know that PCRE doesn't support the [:alpha:],
[:digit:], etc. classes in UTF-8 mode. From
http://www.pcre.org/pcre.txt, under "POSIX
CHARACTER CLASSES":
In UTF-8 mode, characters with values greater than 128 do not match
any of the POSIX character classes.
So, the fact that [:alpha:] doesn't work on UTF-8 strings appears to be
a limitation of PCRE itself. (And I do so strongly wish it were
otherwise.)
Pm
------------------------------------------------------------------------
[2004-10-11 13:00:20] derick@php.net
I can reproduce it too, but I need to think real hard about it first
before I can say whether it is correct or not :)
------------------------------------------------------------------------
[2004-10-11 12:40:36] chregu@php.net
I can reproduce it on Debian, but not on Mac OS X
------------------------------------------------------------------------
[2004-10-11 11:41:34] TiloLutz at gmx dot de
You can find an example at
http://www.stud.uni-karlsruhe.de/~usjp/preg_match.zip
The file is 100% encoded as utf8.
------------------------------------------------------------------------
[2004-10-11 08:01:17] derick@php.net
This depends on how the ä is encoded in your script. If it's just
iso-8859-1 then it won't work. No bug here unless you can come up with
an example that works. (Post a link to a zip file containing your
scripts).
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/30382
--
Edit this bug report at http://bugs.php.net/?id=30382&edit=1