从utf8_unicode_ci Mysql表打印文本时出现错误字符 [英] Bad characters when printing text from utf8_unicode_ci Mysql table
本文介绍了从utf8_unicode_ci Mysql表打印文本时出现错误字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用mysql_query("SET NAMES 'utf8'");
它在mysql表中看起来像ş,ğ,ü".但是,当我使用PHP打印时,
It appears like "ş,ğ,ü" in the mysql table. But when i print it with PHP,
它看起来像"......".在页面上.
it appears like "� ??" on the page.
我尝试添加
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
但是没有用.
如何在页面上正确显示Unicode字符?
How can i show unicode chars correctly on the page ?
谢谢
推荐答案
您应使用:
mysql_set_charset('utf8');
代替
mysql_query("SET NAMES 'utf8'")
我也建议在PHP中设置标头
and I would suggesting setting headers in PHP too
header('Content-Type: text/html; charset=UTF-8');
这篇关于从utf8_unicode_ci Mysql表打印文本时出现错误字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文