What is the best way to convert a string will XML entities like é
to => é
in PHP ?
$string = "\xe9"; // é
echo utf8_encode($string );
is working great,
but what to do with é
replace &# per \ then use utf8 ?
What is the best way to convert a string will XML entities like é
to => é
in PHP ?
$string = "\xe9"; // é
echo utf8_encode($string );
is working great,
but what to do with é
replace &# per \ then use utf8 ?
Prior to PHP 5.4, the encoding defaults to ISO-8859-1
So use:
echo html_entity_decode('é', ENT_COMPAT, 'UTF-8');
Output for 5.0.0 - 5.5.0beta2 (in UTF-8 encoding)
é
You could use html_entity_decode
.