#30382 [Com]: preg_match and utf-8

From: Date: Mon, 06 Dec 2004 21:08:05 +0000
Subject: #30382 [Com]: preg_match and utf-8
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-69860@lists.php.net to get a copy of this message
 ID:               30382
 Comment by:       pmichaud at pobox dot com
 Reported By:      TiloLutz at gmx dot de
 Status:           Assigned
 Bug Type:         PCRE related
 Operating System: Suse Linux 9.1
 PHP Version:      4.3.9
 Assigned To:      derick
 New Comment:

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


Previous Comments:
------------------------------------------------------------------------

[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).

------------------------------------------------------------------------

[2004-10-10 16:20:16] tony2001@php.net

"PCRE related" is the right category for this report.


------------------------------------------------------------------------

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


Thread (1 message)

  • pmichaud at pobox dot com
  • Unknown Message
    • pmichaud at pobox dot com
« previous php.bugs (#69860) next »