How to convert Chinese characters (big5) to UTF-8

Started by shirster, December 04, 2006, 08:55:00 AM

Previous topic - Next topic

shirster

Hi all,

I'm upgrading a Chinese + English web site for a client, and the designer who started the web site set the MySQL database to latin1_swedish_ci. There are 1000+ posts at the moment, most of them are in Chinese.

I need to change the web site to UTF-8, and everything went fine except that none of the Chinese posts can be displayed under UTF-8. I have to change the browser's character set to big5 in order to display the Chinese posts correctly.

I've already done the ALTER TABLE xxx CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; thing in MySQL but that didn't help.

Any thoughts?

Thanks in advance !  ;)
freelance designer and full time day dreamer

CapriSkye

i think you haven't converted your database to utf-8.
if i got this correctly, the posts are shown garbage texts under utf-8 encoding, and will show correctly under big5, that means you haven't convert the characters to utf-8. You will need to export smf's database, convert it to utf-8 (there are some characters that get slash (\) added after converting, you will need to delete them). then import it. at least that's how i did it. good luck...

Sheepy

If you're getting '???', make sure you set the connection charset with SET NAMES 'utf8'

shirster

Thank you, would you mind to tell me in more detail how to convert the db to utf-8? Thanks again !  :) :)
freelance designer and full time day dreamer

CapriSkye

this is how i did it a while ago, there might be some easy ways, but i don't know.
first use phpmyadmin, export smf database. you now get a .sql file, open it with text editor (emeditor) that can handle utf-8. then save as the file, choose utf-8 encoding, turn off BOM. now some characters might get an extra slash (\) as i mentioned above, use search to find them and delete them. if you don't know chinese, it might be hard for you to know which one is the extra one.
then just import to a utf-8 database. i think that's all the steps, but you know about backing up first right?
good luck!

shirster

Thanks, I exported the DB and change the encoding to UTF-8 without BOM, still didn't work. So I decided to give up all the old posts. But I do wanna keep the user data.

The problem is, when I'm on a wrapped forum page (wrapped in Joomla which uses UTF-8 to display Chinese), all the forum text displays ok (as UTF-8) but all the Joomla text becomes broken. But when I switch back to Joomla all the Joomla text is fine.

Any thoughts?

Thanks in advance ! 
freelance designer and full time day dreamer

CapriSkye

someone more knowledgeable has to help you with this. but your db is pretty mess up, with different encodings exist together and all...

shirster

Thanks for your response. Just solved the problem last night. Turns out that even though you wanna use UTF-8 for encoding, you must NOT check the "Use UTF-8" check box when you are installing SMF. I've installed SMF for 6 times before I finally figured out THAT was causing the problem.

Interesting eh? ;)
freelance designer and full time day dreamer

seng

hi, I have installed, using fantaststico in cpanel  smf forum -of english version.I have made some chinese translation all lof which have turned to be  some marks and signs instead of chienese characters and language hxxp:proper.how [nonactive] am I to correc this?

2-How can I install simple machine forum in chinese language alone using fantastisco which
priorpy by defualt  installed in english language by host company?

seng

shirster

Quote from: seng on June 06, 2007, 04:17:54 AM
hi, I have installed, using fantaststico in cpanel  smf forum -of english version.I have made some chinese translation all lof which have turned to be  some marks and signs instead of chienese characters and language proper.How am I to correc this?

2-How can I install simple machine forum in chinese language alone using fantastisco which
priorpy by defualt  installed in english language by host company?

seng

Sorry can't help you with that because I've ditched fantastisco after using it a couple of times. I would not recommend installing anything via fantastisco.

If you go to the Chinese support site of SMF you can download Chinese version of the software and also get community support there.

Good luck ! :)
freelance designer and full time day dreamer

tcwy

Quote from: shirster on December 13, 2006, 11:23:40 PM
Thanks for your response. Just solved the problem last night. Turns out that even though you wanna use UTF-8 for encoding, you must NOT check the "Use UTF-8" check box when you are installing SMF. I've installed SMF for 6 times before I finally figured out THAT was causing the problem.

Interesting eh? ;)

It seems you did install a brain new forum system not upgrade from the old(BIG-5).

shirster

That's correct. I installed a new forum and imported the SQL dump manually.
freelance designer and full time day dreamer

Advertisement: