I was having problem with my wordpress, i could not write or see chinese in my blog. All the chinese characters show up as “????” instead of 汉语/漢語. Actually this problem was discovered by my cousin, Ah Foong, as he was the one trying to post in chinese. I remember him asking me earlier but as i was busy with my work, so i didnt really try to figure it out until today.
I was checking the setting in wordpress option itself but found no hint there. Then i resort to the magic googling and found some pointers, actually it has to do with the sql database collation setting. To display chinese properly, the recommended setting should be UTF8-UNICODE-CI. I know nothing about how to change it for my wordpress SQL database. After some fiddling in the hosting C-Panel, i found access to my wordpress database via the tool phpMyAdmin.
Once in phpMyAdmin tool, you just have to select the database you want to work on, then go to each table, select each field with the wrong collation setting, and change it to UTF8-UNICODE-CI. My original setting was LATIN1-SWEDISH-CI. Actually to display and write chinese properly in your wordpress, you probably only need to change the post content and post title sections, but just to be safe, i have changed all of them.
So now i can finally type and read 漢語in my blog.
你也試試看吧!!
19 Comments»
xfuture2
5. September 2007 | 17:39 hCool, thanks for the tips
So when i can read your chinese post in your blog ? hehe…. i will try it when needed.
my.cosybay » The Legendary Blur Queen
12. January 2008 | 13:39 h[...] Instead of catching up with my sleep, I’m here blogging away and trying to figure out how to type chinese on Wordpress. The character simply becomes ? when I save the post. The problem does not lies between the monitor and the chair okay…tsk tsk it actually lies in the wordpress database encoding settings. I managed to solve the language issue with the help from this link. [...]
Engampmaica
28. March 2008 | 04:49 hSnx for you job!
It has very much helped me!
pedestrain
29. March 2008 | 15:48 hthanks for the solution, it solves my problem too.
WordPress not displaying Chinese correctly | Tongfamily.com
20. April 2008 | 23:31 h[...] Leeping Loon has a completely different fix that has to do with the SQL Database. You have to change the SQL Data collation setting to UTF8-UNICODE-CI and you then go to phpMyAdmin and change the collation settings. [...]
Gary
6. May 2008 | 21:47 h感謝喔!! 終於可以用中文了
弄了好久說….
Scott B
31. July 2008 | 05:15 hYou could also use this SQL command in phpMyAdmin:
[CODE]
ALTER TABLE `wp_comments` CHANGE `comment_author` `comment_author` TINYTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `comment_author_email` `comment_author_email` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `comment_author_url` `comment_author_url` VARCHAR( 200 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `comment_author_IP` `comment_author_IP` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `comment_content` `comment_content` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `comment_approved` `comment_approved` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ‘1′,
CHANGE `comment_agent` `comment_agent` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `comment_type` `comment_type` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
ALTER TABLE `wp_posts` CHANGE `post_content` `post_content` LONGTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `post_title` `post_title` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `post_excerpt` `post_excerpt` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `post_name` `post_name` VARCHAR( 200 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `post_content_filtered` `post_content_filtered` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;
[/CODE]
Scott B
31. July 2008 | 07:12 hSince I’m setting up Wordpress and Joomla both to handle unicode Chinese characters I’ll include the following mysql command set for deploying the same fix for Joomla:
[CODE]
ALTER TABLE `jos_categories` CHANGE `title` `title` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `name` `name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `alias` `alias` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;
ALTER TABLE `jos_contact_details` CHANGE `name` `name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `alias` `alias` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `misc` `misc` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL ;
ALTER TABLE `jos_content` CHANGE `title` `title` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `alias` `alias` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `title_alias` `title_alias` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `introtext` `introtext` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `fulltext` `fulltext` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `metakey` `metakey` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `metadesc` `metadesc` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `metadata` `metadata` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;
ALTER TABLE `jos_menu` CHANGE `name` `name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL ,
CHANGE `alias` `alias` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;
ALTER TABLE `jos_messages` CHANGE `subject` `subject` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `message` `message` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;
ALTER TABLE `jos_newsfeeds` CHANGE `name` `name` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `alias` `alias` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;
ALTER TABLE `jos_sections` CHANGE `title` `title` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `name` `name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `alias` `alias` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
CHANGE `description` `description` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;
ALTER TABLE `jos_users` CHANGE `name` `name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;
[/CODE]
Kathy
7. November 2008 | 03:07 hThanks for the information! You have no idea how great of a help this tip has been!
Aya
19. December 2008 | 01:01 hThanks, I went through and changed everything to utf8 manually in phpmyadmin, and now I can display Chinese. Scott B’s solution looks faster, but it didn’t work for me.
I have a similar problem that was not resolved by this: any Chinese text that does not appear in header.php does not display correctly. So all my Chinese on my footer.php file still displays incorrectly. Any suggestions?
8229
28. January 2009 | 19:09 hMy Message is This!
18858
28. January 2009 | 23:55 hI like this site
Mike
1. February 2009 | 12:14 hThank you very much for this post, I found it very helpful.
Doug
17. February 2009 | 02:01 hhey thanks for the post!
你好,我是 Jess : Cake is Delicious
23. May 2009 | 23:08 h[...] if my Chinese character input is working. I changed some stuff in my SQL database that I found on this post that hopefully has done the [...]
JaneRadriges
14. June 2009 | 05:31 hThe article is usefull for me. I’ll be coming back to your blog.
Jeffrey Chua
14. June 2009 | 11:10 hI encountered the same issue. Thanks to the advices from your site.
KattyBlackyard
15. June 2009 | 14:35 hHi, gr8 post thanks for posting. Information is useful!
GarykPatton
17. June 2009 | 03:16 hHello. I think the article is really interesting. I am even interested in reading more. How soon will you update your blog?