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

Tags: , , , ,

Bookmark and Share

Read also: