php mysql query encoding problem

后端 未结 2 1690
太阳男子
太阳男子 2021-01-16 19:53

I have a page with utf-8 encodin. Mysql is set to utf8_general_ci. Here is the query:

 mysql_query(\"SET CHARACTER SET utf8_general_ci\");

               $         


        
2条回答
  •  情话喂你
    2021-01-16 20:37

    I'm not sure if the mysql_query("SET ..") works as expected. Try setting the character set with mysql_set_charset(). Are you sure the text is inserted like that? If you're using the CLI mysql client with a wrong character set, display output may be faulty as well (that probably goes for retrieval via mysql_fetch_*() as well).

提交回复
热议问题