I’ve had my self hosted WordPress blog for a long time. I just realized that my DB is not UTF8 and certain plugins won’t work correctly.
My question is this. How does a very novice mysql’er go about converting my database? As you can imagine, I’m very hesitant to do this on my own as I have 5 years worth of posts I don’t want to jack up.
Can anyone point me in the right direction, or even better step me through the process for converting everything to UTF8?
After backing up your database as Konerak said, run this for every table:
(you may want to check with
SHOW FULL COLUMNS FROM tablename
whether all (text)columns are now indeed corrrect)And right after you connect to MySQL, run the query:
Now, to tell your audience you are using utf8: you could craft a custom header in every page or in an always included file, I however find it easier to put this in an
.htaccess
for Apache in the root:If you have non-ASCII content in flat files instead of only in the database, you’ll have to convert them too. Your favorite editor may have a batch convert tool, or you can use
iconv
.