I have greek site and all posts in it looks in sourse like:
<p>Ο Μπόνους Γύρος Drunken Clam θα δείτε θα είναι σε θέση να κερδίζει όσο 1000Χ του συνολικού στοιχήματος επιλέγοντας είτε Cleveland, Peter, Quagmire, και</p>
Actually it looks like this on page like this:
Ο Μπόνους Γύρος Drunken Clam θα δείτε θα είναι σε θέση να κερδίζει όσο 1000Χ του συνολικού στοιχήματος επιλέγοντας είτε Cleveland, Peter, Quagmire, και
I need to change html entities to actual symbols (I'm using UTF-8 encoding.) Seems html_entity_decode() doesn't do this. Is here any library or somenthing like this for me to be able to convert text to actual symbols.
PHP version PHP 5.3.29
Thanks!
Upadate: Sorry, this was my shameful mistake. I messed mb_internal_encoding() and 'default_charset' ini directive while was debugging my issue. So I was just have to set encoding for html_entity_decode work as third parameter:
$decoded = html_entity_decode($str, ENT_COMPAT | ENT_HTML401, "UTF-8");
just as Charlotte Dunois wrote. So I set her answer as correct.
If your data is html encoded (eg with PHP's function htmlentities
), you can use html_entity_decode
to decode it back. You may need to set the charset argument if your set charset in the php.ini differs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.