Getting WordPress to encode non-Roman characters properly

025th Jan 2008My Notes, ,

I thought that leaving WordPress’s database charset to UTF-8 would allow WordPress to display Chinese characters properly. UTF-8 is the file format to encode East Asian characters anyway. Even during MySQL installation, choosing UTF-8 charset would save database contents compatible for East Asian characters. But such are the quirks behind this impressive open source software that if didn’t quite do the job.

I noticed that on the first pass into the database, MySQL did encode the HTML code to Chinese perfectly. When I retrieved the entry up for editing, the text appears in Chinese characters too. Impressive! Then, I switched to code view, and I realised that it didn’t switch to ascii code!

I did a short google, and I found the hack to make WordPress display Chinese characters correctly.

In the file wp-config.php, just comment out the lines ->

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

Voila! And your WordPress can now display Chinese characters.

No Comments Comments Feed

Add a Comment

You must be logged in to post a comment.