0

Possible Duplicate:
PHP: Dealing special characters with iconv

I am currently using the following piece of code to translate special characters like é to e. But at the moment the output is as follows.

Player Before: Touré Y.

Player After: TourA� Y.

$normalizeChars = array( 'é'=>'e' ); 
$player = $event->player;
echo "Player Before: $player<br />";
$playerafter = strtr($player, $normalizeChars);
echo "Player After: $playerafter";
Community
  • 1
  • 1
Somk
  • 11,869
  • 32
  • 97
  • 143
  • 3
    Depends on your charset. `strtr` replaces byte-wise. If your input was UTF-8, but you wrote Latin-1 letters in the call, it well screw up the result. – mario Sep 05 '12 at 22:02
  • Why is it replacing the é with A� instead of with an e? The input is from an XML Feed and by using simpleXMLElement which only uses UTF8 – Somk Sep 05 '12 at 22:06
  • @alfasin how did you input the var $player though. If you just put in a special character that works for me too. But as soon as you use an XML feed with an element that contains a special e it fails. – Somk Sep 05 '12 at 22:34

0 Answers0