I am picking up some text from another system which has had text pasted in from Word, or other systems.
Sometimes the apostrophes are displaying with these characters. I can do a search and replace but am sure this is not the best way, as there may be other characters which are behaving in a similar fashion.
I have look at this question [Getting ’ instead of an apostrophe(') in PHP but everything I have tried still does not work.
My simplified code is this.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8_unicode_ci" />
<title></title>
</head>
<body>
<?php
$s = "It’s Getting the Best of Me";
echo $s . "<br>";
$notGiberish = mb_convert_encoding($s, "HTML-ENTITIES", 'UTF-8');
echo $notGiberish . "<br>";
echo html_entity_decode(mb_convert_encoding($s, "HTML-ENTITIES", 'UTF-8')) . "<br>";
?>
</body>
If I have to I will search and replace.
Thanks