PHP: Getting "SSA's" Instead Of "SSA's"
Solution 1:
You can decode
by using these two methods html_entity_decode()
or htmlspecialchars_decode()
Basic Example:
$string = html_entity_decode("SSA's");
echo $string; // result SSA's
$string = htmlspecialchars_decode("SSA's");
echo $string; // result SSA's
Solution 2:
Remove the html_entity_decode
function, as you are double encoding HTML-ENTITIES
And as @ChrisBanks pointed out, you also don't need stripslashes
Solution 3:
You need to call html_entity_decode
again because the data is being stored as double encoded and remove the stripslashes
.
$article_title = html_entity_decode(html_entity_decode(mb_convert_encoding($r->ArticleTitle, "HTML-ENTITIES", 'UTF-8')));
You might want to investigate how the data is being stored in the database as double-encoded in the first place. Perhaps htmlentities
is being called twice somewhere.
To add on to the comment:
You shouldn't store data HTML encoded unless for some reason you really and truly need to (there might be some cases you're required to). It is only on output and rendering on a webpage do you want to use htmlentities
.
Post a Comment for "PHP: Getting "SSA's" Instead Of "SSA's""