php 乱码问题

统一编码很重要 从写入 html --> php -->mysql

再读取返回时,也要注意!!

注意一:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
在php头在 html 这个标签。  这样是html页面的要求

注意二 :
header('content-Type=text/html;charset=utf-8')  
(不过会报warning 不好用)
注意三: mysql_query("set names 'utf8'",$con); //写入时设置 mysql_query("set character set 'utf8'"); //读书时设置  

注意四:
iconv('GB2312', 'UTF-8', $row['XX']); //强制转换编码
注意五: 数据库在创建表时要指定表的编码方式 



原文地址:https://www.cnblogs.com/gfqFighting/p/2583094.html