If you’ve upgraded to WordPress 2.2+ and use the same latin1 database, which has nothing to do with UTF-8 (and you want UTF-8 because it’s good for diacritics and Chinese and everything), it’s high time you converted your database.
Seeing as I too finally did it (a few hours ago), I decided to write this simple HOWTO, mostly for people that don’t actively search for how to make this conversion happen but would need it (it’s based on this HOWTO from WordPress).

Requirements:
- WordPress 2.2+
- The SiteUnavailable plugin (to stave off any chance that your visitors add content to your database while you’re converting it) (version 1.0 archived here)
- The UTF-8 Database Converter plugin (which will be doing the conversion per se) (version 2.0.1 archived here)

Steps:

1. Backup your database.

2. Check your backup.

3. Install the two plugins mentioned above (following the installation instructions for each of them - basically uploading them to wp-content/plugins/).

4. Activate SiteUnavailable. From that point on any visitor coming to your site will see a maintenance page (which can be configured by editing the plugin file).

5. Edit wp-config.php from your WordPress root folder by adding the following 2 lines:

define('DB_CHARSET', 'utf8';);
define('DB_COLLATE', '';);

You can do this by downloading wp-config.php to your computer, using any FTP client such as FileZilla, editing the file in Wordpad (or whatever text editor you’d like), and adding the lines above anywhere between <?php and ?>, saving the file and then uploading it to the server, overwriting the old file.

6. Activate the UTF-8 Database Converter plugin.

7. Go to the UTF-8 Database Converter page, which is available in the Plugins menu.

utf8dbconv.JPG

8. Guess :)

go4it.JPG

9. Deactivate UTF-8 Database Converter and SiteUnavailable from the Plugins menu.

10. Check your site. If all is well you should see no difference whatsoever. On the other hand, if you check your database using phpMyAdmin for example, you’ll see that everything has now been neatly converted to UTF-8.

PS: You can now delete the plugins, of course. You certainly won’t be needing UTF-8 Database Converter anymore (except if you want to use a single WordPress install to convert other databases by just changing wp-config.php settings but I doubt there will be that many sickos out there :) ) and SiteUnavailable… who knows?

Articole similare:

Comments

Leave a Reply