Edit report at http://bugs.php.net/bug.php?id=51313&edit=1
ID: 51313
User updated by: ez dot amiryo at gmail dot com
Reported by: ez dot amiryo at gmail dot com
Summary: str_replace doesn't work properly with non-ascii
characters.
-Status: Open
+Status: Closed
Type: Bug
Package: I18N and L10N related
Operating System: Linux
PHP Version: 5.2.13
New Comment:
sorry. this was my fault.
Previous Comments:
------------------------------------------------------------------------
[2010-03-17 09:46:13] ez dot amiryo at gmail dot com
Description:
------------
str_replace doesn't work properly with non-ascii(128~) characters in
arrays.
I tested below script on cp949 machine.
Test script:
---------------
<?php
echo ConvertPokerCardString( 'QS 4C JC 9D JH 7H AC' );
function ConvertPokerCardString( $str )
{
return( str_replace( array('D','S','H','C'),
array('â','â ','â¥'.'â£'), $str ) );
// below codes works well.
/*
$str = str_replace( 'D', 'â', $str );
$str = str_replace( 'H', 'â¥', $str );
$str = str_replace( 'S', 'â ', $str );
$str = str_replace( 'C', 'â£', $str );
return $str;
*/
}
?>
Expected result:
----------------
Qâ 4⣠J⣠9â J⥠7⥠Aâ£
Actual result:
--------------
Qâ 4 J 9â Jâ¥â£ 7â¥â£ A
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51313&edit=1