#25669 [Opn->Fbk]: eregi() vs. 8-bit chars in regex

From: Date: Fri, 26 Sep 2003 13:13:01 +0000
Subject: #25669 [Opn->Fbk]: eregi() vs. 8-bit chars in regex
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-48142@lists.php.net to get a copy of this message
ID: 25669 Updated by: sniper@php.net Reported By: svs at ropnet dot ru -Status: Open +Status: Feedback Bug Type: Regexps related Operating System: FreeBSD 4.8 PHP Version: 4.3.3 New Comment: I don't think you meant to use those chars in your example script..? Can you please add the actual ones here? Previous Comments: ------------------------------------------------------------------------ [2003-09-26 08:20:57] svs at ropnet dot ru Description: ------------ Even though locale is set up correctly, eregi() fails to match international characters case-insensitively. The reason, as far as I understand, is that code in regex/ passes a negative value to isalpha(). This can be worked around by recompiling regex/regcomp.c manually with -funsigned-char (assuming GCC is the compiler). Reproduce code: --------------- <?php setlocale(LC_ALL, "ru_RU.KOI8-R"); echo setlocale(LC_ALL, ""), "\n"; if (eregi("&#1103;", "&#1071;&#1071;")) { echo "ok\n"; } else { echo "bad\n";} if (preg_match("/&#1103;/i", "&#1071;&#1071;")) { echo "ok\n"; } else { echo "bad\n";} ?> Expected result: ---------------- ru_RU.KOI8-R ok ok Actual result: -------------- ru_RU.KOI8-R bad ok ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25669&edit=1

« previous php.bugs (#48142) next »