MySQL UTF-8 Encoding Problem

MySQLmysql-5phpmyadmin

I have two MySQL databases that are for WordPress websites. One db is for a live version of a site, the second is a copy of the original that is used in conjunction with a copy of the original site. We use the copies for development.

The original site is having character encoding issues, showing the black diamonds with question marks in them. I've gone all over the web looking into this, but nothing is fixing anything. The strange thing is that the second database, which is a copy of the original, displays characters correctly. How could this be? Its nothing with my site files, as I've redirected the original site to use the copy of the database temporarily and the characters display correct on the live site.

Both databases have "latin_swedish_ci" as the database collation and the wp_posts table that fetches the content I'm having problems with is set to a "utf_8" charset with "utf8_general_ci" as the collation. I've tried setting the whole database collation to utf8 (general and unicode), as well as changing the specific database table collations to utf8_general, unicode and tried a few others. It seems like nothing changes at all, I even chose a few arbitrary charsets and the characters just appeared exactly the same. Could this be related to user permissions perhaps, if thats the case?

Thanks for the help in advance.

Best Answer

Not an "answer", but steps for debugging...

All of these need to agree:

If, however, the data is already stored in the wrong encoding, the problem is messier. Do analyze this, do SELECT HEX(col), col ... to look at some particular thing that is causing the black diamonds (etc). Show that to us, plus list the other things; then we can proceed.