How to Fix Funky Characters on Your Blog

Posted by Adam Pieniazek | Blogging Tips | May 9th, 2009

Recently, wordpress changed the default encoding for MySQL databases used in self-hosted wordpress installations from Latin to UTF-8. It’s a smart move and makes wordpress databases adhere to web standards, but the change caused some blogs to display some funky characters, that look like this “—.

For instance, on one of our older posts that was written before the change to the UTF-8 character encoding, an apostrophe was changed to the “— character. Check out the character encoding error below:

Database character encoding causes wordpress to display odd characters

Database character encoding causes wordpress to display odd characters

To check if your blog is affected by these odd characters, simply search your blog for “—. If posts with these funky characters show up, don’t panic! There’s a quick an easy fix that’ll replace these characters with the right characters.

UTF-8 Sanitize plugin to the rescue!

First, back up your database. Here at The 42nd Estate we recommend and use the WordPress Database Backup plugin, which will e-mail you a backup of your database. You can even schedule it to run automatically once a day for no hassle backups. Second, download the modified version of the UTF-8 Sanitize plugin. This modified plugin will go through your database, find these odd characters and replace them permanently. After downloading and activating the plugin, head to your Settings tab in your wordpress administration panel.

There you’ll see the below screen with three options; Outputting Posts, Saving Posts, and Process Posts.

Options screen for the UTF-8 Sanitize plugin

Options screen for the UTF-8 Sanitize plugin

You’ll want to select the Process Posts option, which will permanently update your database with fixes for the character encoding errors. Otherwise, you’ll need to keep the plugin installed permanently and it will update your posts on the fly. Since this can be a huge resource hog, it’s a much better idea to permanently fix your database. That way your posts don’t need to be updated each time a reader views them and you’re free to remove the plugin with no worries.

So, now that you’ve got a backup of your database, go ahead and select Process Posts and then click Update. The plugin will run for either a few seconds or a few minutes, depending on how many posts you have. It’ll then display a Settings saved message after it’s done running. Clear your cache (if you have a caching plugin installed, which we recommend) and then do another search for “— to make sure everything worked. Your MySQL database should now be free of character encoding errors but if not, leave a comment or send us an e-mail and we’ll be glad to try and help.

Tags: , ,

2 Responses to “How to Fix Funky Characters on Your Blog”

  1. Is your wordpress blog plagued with this funky character, “—? Here’s a quick and easy fix: #utf8

    This comment was originally posted on Twitter

  2. Very usefull, Thanks

Recent Posts From The 42nd Estate Network

Recent Posts From The Community