Page 1 of 1

non-unicode character problem

Posted: Tue Jul 28, 2009 8:55 pm
by markthien
Hi guys,

when user enter non-unicode character like chinese characters and I save it to mysql database which become funny character like 手冢治虫 司徒剑桥 å. However, when retrieving it and it display correctly on webpage. is there anyway I can display it correctly in the database where actual chinese character is showed?

I need this because my java application will grab data from database and send out the message to user via SMS and when I check my SMS in my cell phone, all the chinese character also the same as the database one instead of the correct one.

I tried to manually change the data in the database by directly enter chinese character and when sent out the message and I check my cell phone, all the chinese character display correctly.

In addition to that, if the chinese character in the database is actual one like 周华建是怎样一首歌 instead of 手冢治虫 司徒剑桥 å, the webpage display all the chinese character like ?????????

appreciate anyone could help me on this.

regards,
Mark

Re: non-unicode character problem

Posted: Tue Jul 28, 2009 11:16 pm
by Cirdan
All that means is that whatever you use to view your DB doesn't support unicode. As for your web browser, it is probably because you don't have that language installed.

Re: non-unicode character problem

Posted: Tue Jul 28, 2009 11:25 pm
by requinix
That mojibake you're seeing is the UTF-8 encoding of those Chinese characters.

If you're looking at the database directly then it means the characters got utf8_encoded before they were inserted. If you're looking at those characters through the browser then your page isn't set to render as UTF-8.

Code: Select all

header("Content-Type: text/html; charset=utf-8");

Code: Select all

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Either of those should work.

Re: non-unicode character problem

Posted: Tue Jul 28, 2009 11:27 pm
by markthien
you are wrong Cirdan. mysql support utf8 character and I have also set the table/field Charset=utf8 and collation=utf8_general_ci.
if you do not know please do not simple answer question here ok!

Re: non-unicode character problem

Posted: Wed Jul 29, 2009 12:31 am
by markthien
hello tasairis,

It still doesn't work. ok there are 2 situation here:

1. when I use sqlyog to view my data, it display the chinese character correctly like 四大名捕漫画. However, it display ?????? on the webpage.

2. when I use sqlyog to view my data, it display the chinese character like äºŒé›„ 手冢治虫 司徒剑桥 岸本齐史. However, it display chinese character correctly on the webpage.

when user enter their information thru webpage, php save the data (with chinese character) into database and I use sqlyog to view the data and I see something like 手冢治虫 司徒剑桥

when I use java jdbc to save the data (with chinese character) into database and I use sqlyog to view the data and I see something like 四大名捕漫画

please further assist. Thanks !

regards,
Mark