Bug->Req #75225 [Opn]: Add mb_str_replace/mb_str_ireplace
| From: | requinix@php.net | Date: | Mon, 18 Sep 2017 14:29:06 +0000 |
| Subject: | Bug->Req #75225 [Opn]: Add mb_str_replace/mb_str_ireplace | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-211218@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75225&edit=1
ID: 75225
Updated by: requinix@php.net
Reported by: 1234ru at gmail dot com
-Summary: str_ireplace() has no case insensitivity on
non-latin letters in UTF strings
+Summary: Add mb_str_replace/mb_str_ireplace
Status: Open
-Type: Bug
+Type: Feature/Change Request
-Package: *Languages/Translation
+Package: mbstring related
PHP Version: 7.1.9
Block user comment: N
Private report: N
New Comment:
Virtually all of the regular string functions are not for multibyte encodings.
Previous Comments:
------------------------------------------------------------------------
[2017-09-18 14:28:23] spam2 at rhsoft dot net
this is NOT a bug - most of the string funtion don't work for UTF8 at all and be warned about
making decisions about strlen() on UTF8 strings
http://php.net/manual/en/book.mbstring.php
------------------------------------------------------------------------
[2017-09-18 14:27:12] 1234ru at gmail dot com
An actual example is this:
echo str_ireplace("Ð", "1", "ÐÐÐббб");
// yelds 111ббб instead of 111111
(It doesn't allow me to edit the bug description so I post it as a comment.)
------------------------------------------------------------------------
[2017-09-18 14:20:25] 1234ru at gmail dot com
Description:
------------
In other words, it simply ignores case-insensitive replacement when dealing with any letters except
Latin.
Not a single word in the documentation at http://php.net/str_ireplace covers the issue.
And there is no corresponding mb* function.
Test script:
---------------
echo str_ireplace("б", "1", "111ббб"); // russian letters
in UTF-8 encoding
Expected result:
----------------
111111
Actual result:
--------------
111ббб
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75225&edit=1