#34113 [Opn->Fbk]: mb_ereg_replace does not function as it should under "UTF-8"
| From: | sniper@php.net | Date: | Sat, 13 Aug 2005 18:38:26 +0000 |
| Subject: | #34113 [Opn->Fbk]: mb_ereg_replace does not function as it should under "UTF-8" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83540@lists.php.net to get a copy of this message | ||
ID: 34113
Updated by: sniper@php.net
Reported By: mlmlml at lily dot freemail dot ne dot jp
-Status: Open
+Status: Feedback
Bug Type: mbstring related
Operating System: windows 2000 server
PHP Version: 4.3.11
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2005-08-13 01:15:17] mlmlml at lily dot freemail dot ne dot jp
Description:
------------
When "mb_ereg_replace" is used under "UTF-8" source environment, it
does not seem to recognize gmulti-byte spaceh (zenkaku-space in
Japanese). The same code runs correctly under gEUC-JPh source
environment, so I supposed this was something buggy rather than
mis-usage of the function.
[mbstring]
mbstring.language = Japanese
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto
mbstring.http_output = UTF-8
;mbstring.encoding_translation = Off
mbstring.detect_order = auto
mbstring.substitute_character = none;
;mbstring.func_overload = 0
Reproduce code:
---------------
<?php
/*
the all three var_dump()s "UTF-8", and this verifies
the source is actually run under "UTF-8"
*/
var_dump(mb_regex_encoding());
var_dump(mb_internal_encoding());
mb_regex_encoding(mb_internal_encoding());
var_dump(mb_regex_encoding());
/*
Although this var_dump should give
"**********@*****"
by recognising "@"(multi-byte space),
when it is run under "UTF-8", it gives
"****************".
This assures that the "multi-byte space" is not
recognised as it should.
*/
$string = "multi-byte@space";
var_dump(mb_ereg_replace('[^@]', '*', $string));
?>
Expected result:
----------------
multi-byte space should not be converted to "*" in the reproduce code
since the regular expression is "[^@]".
Actual result:
--------------
multi-byte space is ignored and converted to "*".
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34113&edit=1