I have a site where text from a mysql database is retrieved and displayed on a page. Someone wrote:
"Can't wait to meet him (smiley emoticon)"
It displays fine on the first site, but I copied the database over to another site and when that second site displays it, it adds weird characters, like this:
"Can’t wait to meet him😉"
Why would the same info from two mysql databases display differently? I obviously would like the second site to show it how it appears on the first site.
The first site echoes it back like this:
echo "<span class='comment'>" . $row['comment'] . "</span>";
The second site uses htmlspecialchars, which I thought was the right way?
echo "<div class='comment'>" . htmlspecialchars($row['comment']) . "</div>";
What am I missing here?
FYI, only difference I can think of is that I used mysqli to retrieve it on first site, and am using PDO to do so on the second site. Not sure if that could explain anything.