#30382 [Bgs->Opn]: preg_match and utf-8

From: Date: Mon, 11 Oct 2004 09:41:36 +0000
Subject: #30382 [Bgs->Opn]: preg_match and utf-8
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-67401@lists.php.net to get a copy of this message
ID: 30382 User updated by: TiloLutz at gmx dot de Reported By: TiloLutz at gmx dot de -Status: Bogus +Status: Open Bug Type: PCRE related Operating System: Suse Linux 9.1 PHP Version: 4.3.9 New Comment: You can find an example at http://www.stud.uni-karlsruhe.de/~usjp/preg_match.zip The file is 100% encoded as utf8. Previous Comments: ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ [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

« previous php.bugs (#67401) next »