Edit report at http://bugs.php.net/bug.php?id=51313&edit=1

 ID:               51313
 Updated by:       ahar...@php.net
 Reported by:      ez dot amiryo at gmail dot com
 Summary:          str_replace doesn't work properly with non-ascii
                   characters.
-Status:           Closed
+Status:           Bogus
 Type:             Bug
 Package:          I18N and L10N related
 Operating System: Linux
 PHP Version:      5.2.13



Previous Comments:
------------------------------------------------------------------------
[2010-03-17 09:47:26] ez dot amiryo at gmail dot com

sorry. this was my fault.

------------------------------------------------------------------------
[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

Reply via email to