Have you been to a blog or website with characters in the titles and article contents like Â, â€™ and â€“?
If you are following this blog, you may have noticed that after 18 hours of downtime, it was back again only to see those weird looking characters in many of my posts.
This usually happens when either you restore your blog database, or move your blog to another hosting account (as in my case). It mostly affects words with ‘single’ or “double” quotes, or words like don’t, doesn’t, it’s, etc.
After some googling, I found out that my database encoding was in Latin1 but wordpress uses utf-8 database encoding (heck, I don’t also know what those stuff mean). Newbie as I am on things “techie”, I learn things mostly the hard and painful way – and this one was no exception.
When you backup your database in latin1 encoding it defaults to utf-8 db encoding when you import it through PHPMyAdmin or restore using Bigdump for really big databases.
So here’s the quick solution! You need to do this BEFORE you restore your database.
Open your WP-CONFIG.PHP file using a PHP editor program like Notepad++. Find the following lines:
/** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8'); /** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', '');
All you need to do is to “comment” out these two lines.
/** Database Charset to use in creating database tables. */ // define('DB_CHARSET', 'utf8'); /** The Database Collate type. Don't change this if in doubt. */ // define('DB_COLLATE', '');
The problem will not be solved if you change these settings in wp-config.php AFTER you have restored your database. You need to drop the tables, and perform the restore process again if that’s the case.
Once everything is okay, you can switch back to the original wp-config.php configuration.
I know there are a lot of other more “sensible” solutions out there. WordPress also has a recommended solution, but for a non-techie like me, there’s no way that I can do those steps.
This one works pretty nice and easy. If you have a better solution, feel free to share it here.