r/PHPhelp • u/[deleted] • Jan 30 '20
Encoding issue, trying to replace strings but getting a way different result
<?php
function Utf8_ansi($valor) {
$utf8_ansi2 = array(
"\u00c0" =>"À",
"\u00c1" =>"Á",
"\u00c2" =>"Â",
"\u00c3" =>"Ã",
"\u00c4" =>"Ä",
"\u00c5" =>"Å",
"\u00c6" =>"Æ",
"\u00c7" =>"Ç",
"\u00c8" =>"È",
"\u00c9" =>"É",
return strtr($valor, $utf8_ansi2);
}
$test='\u00e9", ';
echo Utf8_ansi($test);
?>My output is és",
Any ideas?
7
Upvotes
1
u/Kit_Saels Jan 30 '20
Your keys are not UTF8. They are Unicode.