Bug #25953 [Com]: mb_eregi_replace() is not case-insensitive for multibyte characters.

From: Date: Wed, 22 Aug 2012 11:49:40 +0000
Subject: Bug #25953 [Com]: mb_eregi_replace() is not case-insensitive for multibyte characters.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-172794@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=25953&edit=1

 ID:                 25953
 Comment by:         iam at xatory dot ru
 Reported by:        kirill at digicol dot de
 Summary:            mb_eregi_replace() is not case-insensitive for
                     multibyte characters.
 Status:             Wont fix
 Type:               Bug
 Package:            mbstring related
 Operating System:   Linux Suse SuSE 8.2
 PHP Version:        4.3.4RC2
 Block user comment: N
 Private report:     N

 New Comment:

You can replace mb_eregi_replace with preg_replace with u modifier.

Example (utf-8 file encoding):
<?php
echo preg_replace('/(юникод)/iu', '<b>\\1</b>',
'Юникод удобен');
?>

As expected result is:
<b>Юникод</b> удобен


Previous Comments:
------------------------------------------------------------------------
[2003-10-24 13:35:18] moriyoshi@php.net

As of the current regex engine used by mbstring extension, all of the cyrillic / greek / arabic
characters and some alphabetical characters that are not part of ascii character set such as
a-umlaut (ä) aren't handled correctly under case-insensitive mode. Probably the issue will be
resolved in php5.


------------------------------------------------------------------------
[2003-10-22 10:16:53] kirill at digicol dot de

Description:
------------
The function mb_eregi_replace() is not caseinsensitive for multibyte characters.

This bug is in PHP 4.3.3 as well.

Reproduce code:
---------------
<?php
mb_regex_encoding('UTF-8');

$pattern = utf8_encode('ü');
$replace = 'X';
$subject = utf8_encode('ÜBER über');

$result = mb_eregi_replace($pattern, $replace, $subject);

echo utf8_decode($result) . "\n";
?>

Expected result:
----------------
XBER Xber

Actual result:
--------------
ÜBER Xber


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



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=25953&edit=1


Thread (3 messages)

« previous php.bugs (#172794) next »