Ultimate solution to weird UTF character encoding problem

Due to different formats of storing characters in the database, sometimes you may encounter problem with strange characters (like —) appearing in your WordPress posts. This can especially happen when moving the site to a different server, a process during which your database needs to be exported and imported.

There are several ready solutions to this problem like modifying the character set before and after the database restore as described in this article.

There is also a ready WordPress plugin called bbWP2UTF8, that will try the conversion to UTF charset.

If that did not help you have one more solution, try UTF8 Sanitize plugin. This plugin will exchange the weird characters with their valid counterparts on the fly. However this will also slow down your blog, as every time a page is loaded it will need to be parsed and changed by the plugin.

I have created a modification of the plugin which will add an option to change all posts in the database permanently.

Download Modified UTF8-Sanitize Plugin

To use it first check the first option 'Outputting posts' and try your site. If everything looks OK now, select the third option, 'Process all posts on saving options' and update the options. This will go through all the posts in the database and apply the changes. After this you may freely deactivate the plugin. Make sure you backup your database before trying anything!

More like this:

Posted in: WordPress
TAGS:, , , , , , , , , , , , , , , , , , , , , ,
Both comments and trackbacks are currently closed.

One Comment

  1. Feb 22nd, 2012 4:23 PM

    Worked perfectly, was having issues after a site migration, pages weren't always loading properly, garbled text on existing posts and pages, RSS feed was all messed up - this seems to have cleared the lot up, excellent work!