problem with special characters

≡放荡痞女 提交于 2019-12-02 04:44:23

You need to tell to MySQL that the connection must be made in UTF-8. To do so use the function mysql_set_charset (you need PHP 5.2.3). If you use PHP < 5.2.3 try :

mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $conn);

Also make sure the headers tells that the document is in UTF-8 (header function and/or HTML meta tags correctly set).

Also make sure your PHP files are saved in UTF-8 without a BOM.

How did you add these characters into the document? Depending on the editor the encoding can be skewed when saving. Did you set the document type in HEAD using META in addition to specifying the encoding using PHP headers?

Here is some further reading on the subject http://htmlpurifier.org/docs/enduser-utf8.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!