I use the powerful BackupBuddy plugin by iThemes to take a regular automated backup of all my sites. This plug-in also doubles up as a web host migration tool. This time when I cloned one of my wordpress based sites to a staging environment, I started seeing lots of weird characters in the article like these Â â €
I found this helpful article which went into details about what can be wrong. Essentially the older wordpress blogs that were created before WordPress v2.3 didn’t use to specify the default character set for character encoding hence the wordpress tables were created with the default set of MySQL installation which was Latin1. The wp-config file that shipped with the earlier versions didn’t have character encoding info inside it.
Post v2.3, wordpress started using the omnipresent ‘utf-8’ character encoding for the MySql installation. This conflict between character encoding turned out to be the cause for such weird characters inside my site’s articles.
While the fact finding was tough, the fix was quite simple:
Just add these two lines to wp-config.php file present in the root directory of your wordpress installation and your site will be back to normal.
define('DB_CHARSET', 'utf8'); /* Database Charset to use in creating database tables. */ define('DB_COLLATE', ''); /* The Database Collate type. Don't change this if in doubt. */
If you have little bit of interest in programming, you should definitely learn more about character encoding. Joel Spolsky, CEO of StackExchange has explained in depth about this topic. You can also learn more about character encoding in the video below