开发者

Retrieve multi language text from DB in php

I am using MySQL phpmyadmin. I have a inserted a multi-lingual text into DB the Collation is utf8_unicode_ci now i want to retrieve the values from DB and to store into a file. while i reading the text it returns ?????????? but the original text is தமிழ்.

i have written the text directly to the file and it is stored the text as தமிழ்தமிழ் (some square brackets), but while reading from DB since it is returning as ?????????? the file has been return as ??????????. How ca开发者_如何学运维n i read from DB correctly the text as it is.


Try sending the following query after connecting to the database:

If you're on mySQL < 5.0.7:

mysql_query("SET NAMES utf8;");

if you're on a newer mySQL:

mysql_set_charset("utf8");

AND

 header('Content-type: text/plain;charset=UTF-8'); 


Try to execute 'SET NAMES utf8;' before the reading table.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜