How to

Convert WordPress database charsets – UTF-8 encoding issues

If after moving your WordPress database around you find your site full of weird characters then your are likely suffering from double UTF-8 encoding problem. It is not a WordPress bug, but it is the way MySQL internals work.

To check if you are having this problem, you can try to comment out the line containing DB_CHARSET in your wp-config.php file. If your text is back to normal, then you are probably experiencing double UTF-8 encoding. WordPress Codex has an article covering this:

We released a script at our public github which puts all this together and solves the double UTF-8 encoding issue. It works by scanning all your tables and columns and generating a list of SQL statements which allow you to convert your content to UTF-8. To be run in the command line like this:

./wp-utf8ize.php > utf8ize.sql

UPDATE: There is a plugin on our Github account that does this task in a simpler way. Please note, this plugin is not maintained anymore and using it comes at own responsibility.

Smart Managed WordPress Hosting

Presslabs provides high-performance hosting and business intelligence for the WordPress sites you care about.

Signup to Presslabs Newsletter

Thanks you for subscribing!