I am encountering an issue with em dashes that I haven't been able to resolve. For our site, we store text content in a 'content' column in a MySQL database that will occasionally contain special characters, all of which appear correctly except for the em dash. Any em dashes in the entered text turn into question mark diamond replacement characters when printed out on the site.
The bug only appears on our production site (on our development site and staging site, the emdashes render correctly), which leads me to believe it may be an issue with character sets on their respective databases (our development/staging databases are hosted on one server, and production on a different server). However, the column containing the text content in question is set utf-8 on all the databases. Wrapping the output in htmlspecialchars() didn't work.
Of note is the fact that when I used print_r() to print the variable into which I was saving the fetched DB results (for debugging), the em dashes would then render correctly when printed out below.