开发者

mysql encoding problem

i have a proble, when insert something in foreign language into database. i have set the collation of dat开发者_如何转开发abase to utf8_general_ci(try utf8_unicod_ci too). but when i insert some text into table, it was saved like this

Õ€Õ¡ÕµÕ¥Ö€Õ¥Õ¶ Ô±Õ¶Õ¸Ö‚Õ¶

but when i read from database, text shows in correct form. it looks like that only in database.

i have set encoding in my html document to charset=UTF-8

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

and i set

mysql_query("SET NAMES UTF-8");
mysql_query("SET CHARACTER SET UTF-8");

when conecting to database. so i think that i' ve done everything, but it still save in that anknown format. could you help me. thanks in advance


I believe you have to SET NAMES utf8, instead of UTF-8, in MySQL.


It looks like maybe your phpmyadmin isn't using the correct charset. In your phpmyadmin folder, open config.default.php and edit the lines

$cfg['DefaultCharset'] = 'iso-8859-1';
$cfg['DefaultLang'] = 'en-iso-8859-1';

To your chosen encoding.


It is suggested to use mysql_set_charset() instead of "SET NAMES" query, however the impact should be the same.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜