0

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.

  • Do you have some sort of cache?Also take a look here stackoverflow.com/questions/279170/utf-8-all-the-way-through – Mihai Feb 24 '15 at 17:03
  • 1
    Does the data look okay in phpMyAdmin on both databases? That's a quick way to determine whether it's stored incorrectly. Changing the collation won't fix badly encoded data that already exists in the database; it will help with newly inserted data, though. – ibennetch Feb 25 '15 at 13:38
1

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.

  • To add; don't forget about Server, Database, and the Table levels that may also play a part. but to Rick's point bad processed data is still bad data. – JayRizzo Dec 9 '16 at 7:12
  • 1
    I left out Jay's point because they are only defaults for the next lower level; all that really counts is the CHARACTER SET on the column in question. – Rick James Jul 6 '17 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.