Log in

View Full Version : charset



sujith787
09-08-2007, 11:19 PM
in my PHP Mysql data base i have a table.
the table field values are in UNICODE FONT. (eg:. எடுத்து காட்டு.) this is UNICODE TAMIL FONT. but when i retrive that same data from the table the output come like this ?????????????????????? . what is the problem. wht i have to do for this is there any collation type to display the UNICODE fonts correctly? i tried UTF8_UNICODE_ci collation.

please sort out this problem.

i tried by changing the php.ini file

default_charset = "utf-8"

Twey
09-08-2007, 11:24 PM
PHP doesn't handle multibyte characters well. There are some hacks to attempt to implement it (such as the mbstring extension) but it would be much easier to go with a different language.

sujith787
09-08-2007, 11:41 PM
but, i get error only with the text which comes from database.
in the same page. the other texts (static texts) are display correctly

sujith787
09-09-2007, 12:44 AM
when i see the database the text display correctly. when i get that same text in my php page it comes like "?????????????????????????????"

in the same page i have same unicode static text they comes good in php

Twey
09-09-2007, 01:20 AM
Have you executed:
mysql_query('set names \'utf-8\'')before querying your database?

sujith787
09-10-2007, 12:20 AM
thank you mr twey.

i didnt do that. actually i dont know whts that.

can u please tell me where i have to do that. how i have to excecute it plz tell me

Twey
09-10-2007, 12:49 AM
It's a simple PHP statement... put it after connecting to your database and before executing your UTF-8 queries.

sujith787
09-10-2007, 07:05 PM
thank you twey.

i tried this also. but didnt get anything.

iam entering datas directly in the database.
the text in database table is correct.

but when i retrive it in php page i get error.

http://brownjoint.com/tamilsource/website/tsmagazine/test.php

this is the link in this page

"விளம்பரம்...." and "மனிதனின் தலையில்................................"

both are static text whih i am getting correctly..


in the right side top we have text like " ??????????????????? 1" and
" ????????????? 2"

this text iam getting from mysql data base. but in database this are "வணக்கம் 1" and " நன்றி 2"

but when i get this text in php page in output it comes like "?????????? 1" and " ???????? 2"

this is the exact problem.

please tell me the problem. in mysql database i used utf8_general_collation,
i changed my php.ini file default charset "utf8"

still iam getting problem

Twey
09-10-2007, 08:18 PM
iam entering datas directly in the database.Then I suspect you're entering them in the wrong character set. Have you checked the encoding on your terminal? If you're using Windows, I'm not sure how much you can do: DOS and cmd.exe are rather more limited.

sujith787
09-12-2007, 09:19 PM
thanks twey.

your previous answer is correct. mysql_query("SET NAMES 'utf8'");

sorry i tried wrongly.

thanks a lot for your help