[英]php htmlentities showing utf-8 encoded characters
Please hove on the first thumbnail here: http://dev.holiday.ge/?s=bar 请点击这里的第一个缩略图: http ://dev.holiday.ge/?s = bar
??????
will be displayed. 将显示。 This is utf-8 text and I run it through php
htmlentities()
这是utf-8文本,我通过php
htmlentities()
运行它
Can someone explain what is happening? 有人可以解释发生了什么吗?
Do I have to encode htmlentities to make it display utf-8 text display correctly? 我是否必须编码htmlentities才能正确显示utf-8文本显示?
Any thoughts? 有什么想法吗?
thanks! 谢谢!
I know that my comment helped to fixed your issue. 我知道我的评论有助于解决您的问题。
Here is as answer 这是答案
echo htmlentities($str, ENT_QUOTES | ENT_IGNORE, "UTF-8");
Have you checked the field's Collation is utf8_general_ci also have you used 你有没有检查过该字段的校对是utf8_general_ci你也使用过
Also have you added this code after you select the DB by using mysql_select_db('dbName'); 在使用mysql_select_db('dbName')选择数据库后,您也添加了此代码;
mysql_query('SET character_set_results=utf8');
mysql_query('SET names=utf8');
mysql_query('SET character_set_client=utf8');
mysql_query('SET character_set_connection=utf8');
mysql_query('SET character_set_results=utf8');
mysql_query('SET collation_connection=utf8_general_ci');
Comment it pls. 请评论一下。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.