php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30851 Some char cann't be replaced.
Submitted: 2004-11-20 15:57 UTC Modified: 2004-11-21 17:35 UTC
From: ibar at 163 dot com Assigned:
Status: Not a bug Package: Regexps related
PHP Version: 4.3.9 OS: RH9
Private report: No CVE-ID: None
 [2004-11-20 15:57 UTC] ibar at 163 dot com
Description:
------------
When I use the eregi_replace function, I can't replace the traditional chinese letter "4" with the simplified chinese letter "4". But the str_replace function can do.

Can you tell me which function can be used to complete it?

PS: the tradional chinese letter "4"'s specific character
is 0xA57C. But the problem appeared when replaced to the letter "7C" .

Reproduce code:
---------------
$Strings="i am ?| ^o^";
print eregi_replace("?|","4",$Strings);

Expected result:
----------------
i am 4 ^o^

Actual result:
--------------
Warning: ereg_replace(): REG_EMPTY in /home/site/math.php on line 9

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-21 08:32 UTC] tony2001@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

POSIX regexps doesn't support multibyte symbols.
You should use mb_eregi_replace() instead.
 [2004-11-21 08:52 UTC] ibar at 163 dot com
Call to undefined function: mb_eregi_replace() 

How to use mb_eregi_replace ?
 [2004-11-21 08:59 UTC] tony2001@php.net
You need to enable mbstring extension first.
http://php.net/mbstring
 [2004-11-21 17:35 UTC] derick@php.net
You can also just use str_replace() here...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 15 08:01:30 2024 UTC