Reputation: 33
I have some string with arabic encoded and ukrainian (cyrillyc) words, like this:
$string = "اِئْتِلافِيٌّ - коаліційний, гармонійний;";
and I want to get characters (arabic) instead all this "&#xxxx;"`s.
If I putting this string into html, I'm getting exactly what i want: "اِئْتِلافِيٌّ - коаліційний, гармонійний;"
But when I use html_entitis_decode, it does nothing. (mb because arabic encoding does not supports with this function, just basic ASCII). So, plz tell me what should I do to get same result as browser interpreter?
Upvotes: 3
Views: 1563
Reputation: 13257
Your PHP version is probably older than 5.4.0, thus html_entity_decode
is not using UTF-8.
Encoding to use. If omitted, the default value for this argument is ISO-8859-1 in versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards.
http://php.net/manual/en/function.html-entity-decode.php
Try the following:
$decoded_string = html_entity_decode($string, ENT_COMPAT | ENT_HTML401, "UTF-8");
Upvotes: 1