Home  >  Article  >  Backend Development  >  mysql - 一个比较大的php程序,需要由gbk修改到utf8.有哪些需要注意的地方?

mysql - 一个比较大的php程序,需要由gbk修改到utf8.有哪些需要注意的地方?

WBOY
WBOYOriginal
2016-07-06 13:51:28939browse

1 修改了数据库的编码。
2 文件编码都改为utf8
3 html 的charset = utf8

可是还是不行,有很多地方还是有乱码不知道错过了什么。

ps。
后期可能会用react native 应该是不兼容gbk的吧?

回复内容:

1 修改了数据库的编码。
2 文件编码都改为utf8
3 html 的charset = utf8

可是还是不行,有很多地方还是有乱码不知道错过了什么。

ps。
后期可能会用react native 应该是不兼容gbk的吧?

修改了数据库编码 修改数据库编码必然造成乱码,应该先导出为sql文件,然后新建utf8的数据库,再把数据导进去。导入前还要检查导出的sql文件中是否有charset的定义,有的话需要替换为utf8。
另外,php连接数据库后马上就要执行set names utf8。

数据库也得改啊。

数据库字符集

数据库字符集

连接字符集,校对字符集,传输字符集,header头,数据库存储数据用的字符集

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:SEO 统计算法Next article:html - 怎么终止php代码