#30382 [Opn]: preg_match and utf-8
| From: | tony2001@php.net | Date: | Sun, 10 Oct 2004 14:20:27 +0000 |
| Subject: | #30382 [Opn]: preg_match and utf-8 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67360@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: Open
Bug Type: Regexps related
Operating System: Suse Linux 9.1
PHP Version: 4.3.9
New Comment:
"PCRE related" is the right category for this report.
Previous Comments:
------------------------------------------------------------------------
[2004-10-10 16:00:19] aidan@php.net
Reassigning to proper category.
------------------------------------------------------------------------
[2004-10-10 15:49:47] TiloLutz at gmx dot de
Description:
------------
preg_match doesn't work correct when utf-8 is used
preg_match('/^([[:alpha:]])*$/u', "ä")
should return true because [[:alpha:]] contains
also localized special characters like äöü.
Unfortunatly it returns false.
It works with iso-8859-15 but doesn't work with utf-8
Reproduce code:
---------------
putenv("LANG=de_DE");
setlocale(LC_ALL, "de_DE");
if (preg_match('/^([[:alpha:]])*$/u', "ä") echo "true";
putenv("LANG=de_DE.utf8");
setlocale(LC_ALL, "de_DE.utf8");
if (preg_match('/^([[:alpha:]])*$/u', "ä") echo "true";
Expected result:
----------------
true
true
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30382&edit=1