’ � Strange Characters in WordPress posts

After upgrading WordPress, many people may encounter strange characters in WordPress posts text. This issue typically presents after upgrading or moving WordPress. It appears to be a character set or charset encoding problem where apostrophes, hyphens, quotation marks and dashes appear or are displayed in posts and pages as strange characters like ’ �., or even as simple ? (question marks). Yes, the symptoms are obvious. WordPress posts and pages suddenly contain garbled, weird, or strange characters. Sometime just lots of ????? (question marks) rendering the WordPress database with your hard work useless and output nearly unreadable. Moreover, this problem can quickly become very frustrating. Before reverting back to an earlier version or reinstalling your database, read ahead.

WordPress database character set and coalition problem:

As it turns out, starting with WordPress version 2.2, the WordPress team added a nice new option. The ability to define WordPress database character set and coalition values in the wp-config.php file. Consequently, these defines now set the database character set to utf8 by default. For people installing WordPress for the first time, these default defines are fine. However, if the previous WordPress database was not explicitly set as a Unicode UTF-8 charset collation to begin with, these new default defines can pose problems. For example, let’s say my default database charset is Latin1. If a UTF-8 define is now forced, my post text would be incorrectly decoded. As a result the text would not render correctly.

How to fix the strange characters in WordPress posts:

    1. Access your WordPress directory via ftp
    2. Locate and open the WordPress wp-config.php file. Find and delete the following two lines:

define(‘DB_CHARSET’, ‘utf8?);
define(‘DB_COLLATE’=, “);

  1. Save your changes and go view your site

If all went well, you can get back to writing properly decoded content! 🙂