WordPress Charset Encoding Problem After Upgrading to Version 2.2

»»»WordPress Charset Encoding Problem After Upgrading to Version 2.2
WordPress blogs that upgraded to WordPress version 2.2 may encounter strange character set (charset) encoding problem where several characters especially apostrophes (‘), quotation marks (“), and hyphens or dashes (—) are displayed as strange characters such as ’ or simply as question marks (?) when the posts are output to web pages. As you have probably suspected, the issue is caused by character encoding method used by WordPress 2.2 which supports setting of database collation and character set in WordPress config file.

The error happens because up to and including WordPress ver 2.1.3, almost all WordPress databases were created using the latin1 character set and the latin1_swedish_ci collation. Beginning WordPress v2.2, WordPress allows the user to define both the database character set and the collation in wp-config.php file, using DB_CHARSET and DB_COLLATE values. With these values set to another encoding, WordPress assumes that the databases are indeed using the charset and collation too, where it’s not the case for existing WordPress installation. So if you’re upgrading WordPress to 2.2 using the default wp-config.php, or have manually modified the file to include the new variables, or upgrading by using Fantastico which automatically update the wp-config.php file to include these two definitions which values set as Unicode UTF-8 by default, you will need to remove these definitions to solve the character encoding error.

Open and edit your WordPress wp-config.php file. Then locate the following two lines:

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

You can simply delete these 2 lines away, or just remove the utf8 from the first line to make them looks like this:

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

With no charset and collation values set, WordPress will fall back to the old default, latin1 which matched the databases.

A possible better solution is convert the WordPress database to UTF8 Unicode.

By |2016-12-09T08:39:55+00:00December 9th, 2016|Categories: Web Publishing|Tags: |32 Comments

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years.Connect with LK through Tech Journey on Facebook, Twitter or Google+.