Solved: Drupal Cannot Display Chinese Characters (Unicodes)

Filed in: Open Source, Tips n Tricks, Web Development — May 12th, 2008

advertisement

I have a community site powered by Drupal but it cannot display chinese characters, even though it supports unicode by default.

All non-English characters are displayed as question marks (???). I tried to reinstall Drupal but without any luck. Yesterday, I finally discovered the problem and solved it!

The problem

Last time, I installed Drupal using the cPanel Fantastico script installer. The installer created database using Latin collation. That’s why Drupal cannot display Chinese characters because the database is not unicode (UTF-8).

Lesson learned: Do not install script using cPanel Fantastico.

The solution

The solution is simple, correct the tables’ collation to UTF-8 using the following SQL query (thanks to neo_fox):

ALTER TABLE table_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

I ran the query using phpMyAdmin found in cPanel hosting control panel. But the drawback is that you need to run the SQL query for every single table…

I modified 20+ tables and it works! Now my friends can leave chinese message on the community website. :D

Bookmark and Share

Tags: , , , ,

Read also:

  • What is the address of the site? would like to see what mr.liew is up to.
  • LcF
    Just a private community site for friends to rant. Nothing serious there ;)
  • good info. thou' im not going to use the chinese characters, but this helps me handling php scripts out there. thanks
  • I think wordpress has this problem as well. Have not fix my wordpress yet so that I can blog in chinese..
  • LcF
    @Alien TYC: wordpress has a different solution. Check out "Fix Wrong Encoding after Upgrade Wordpress 2.2"
  • macrunch
    I m your friend?what is the site URL?
  • It's not working for me;/ Maybe I'm doing something wrong but what?
  • somedude
    Thx dude! This article help me to solve same problem with russian language!
blog comments powered by Disqus