I have a problem displaying Chinese encoding on my blog. After researching and getting no answers, I sent an email to my hosting company, Site5. They replied : I'm not too comfortable dealing with MySQL - this is my first self-hosted blog. I don't expect you guys to do the dirty job for me, but could you: 1) Tell me if the suggestion from Site5 looks smart (I don't want to play with MySQL for nothing !) 2) Point me to a good and clear MySQL guide for backup/ reinstall (so many advice out there... I need something reliable) 3) Import the data in UTF-8 encoding ??? I don't get this step... I know I sound scare but... yeah, I am Thanks a lot !
This site might help you figure out whats wrong with encoding. http://www.herongyang.com/PHP-Chinese/index.html
Couple things, first make sure your table is specifically setup to store UTF8. The collation for the table should be something like "utf8_general_ci". If the table is stored as utf8, check the data to see if it's storing the right info when you make a post. If it is, then you've got a display problem. Make sure the post is being returned as UTF8. When using firefox, right click on the page that should have Chinese and click on "View Page Info". You should see an Encoding field at the top that says "UTF-8". To make your page return UTF-8 it has to set it in the header using: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> If this is set and the page is returning UTF-8, then it may be a problem with your php commands to either set or get the utf-8 data. I've had quite a few problems in the past doing this, including having to put mysql specifically into utf8 mode, etc. But you first want to figure out where the problem is. Storing, Fetching, or Displaying. Try putting some static chinese text on the page (html) that is pulling the post. For example in the template. IF you can see the chinese, then it's not a problem with the displaying of the chinese (html encoding) but with the setting/fetching itself.
Thanks for the post, very informative ! Alright, so from what I see... In MyPhpadmin : # MySQL charset: UTF-8 Unicode (utf8) # MySQL connection collation: utf8_unicode_ci" When I open the wrdp table, they're all set in : latin1_swedish_ci Using FF, I checked the page encoding : text/html; charset=UTF-8 So, diagnostic, doctor(s) ? Sorry, I'm still new at that !
Update... I finally tried the solution I posted first (dropping the WP table and recreating the database). I did import my data specifying the UFT-8 encoding... but once again, I ended up with latin1_swedish_ci tables. I don't understand !!! What else can I do to finally show "nice" Chinese posts (instead of my ????? characters...).
To change your table to UTF8 try the following command: ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8; For more information see the alter table reference at: http://dev.mysql.com/doc/refman/5.0/en/alter-table.html
Okay, I finally made it ! Thanks for your help... the problem was the character set and yes, I did have to convert. Whew, took me a while to get that one but my Chinese posts finally look like Chinese and not ?????