Home > Backend Development > PHP Tutorial > mysql - a relatively large php program that needs to be modified from gbk to utf8. What are the things that need to be paid attention to?

mysql - a relatively large php program that needs to be modified from gbk to utf8. What are the things that need to be paid attention to?

WBOY
Release: 2016-07-06 13:51:28
Original
1010 people have browsed it

1 Modified the encoding of the database.
2 The file encoding is changed to utf8
3 The charset of html = utf8

But it still doesn’t work. There are still garbled characters in many places and I don’t know what I missed.

ps.
React native may be used later. Is it incompatible with gbk?

Reply content:

1 Modified the encoding of the database.
2 The file encoding is changed to utf8
3 The charset of html = utf8

But it still doesn’t work. There are still garbled characters in many places and I don’t know what I missed.

ps.
React native may be used later. Is it incompatible with gbk?

Modified the database encoding <- This is too powerful
Modifying the database encoding will inevitably cause garbled characters. You should first export it to a sql file, then create a new utf8 database, and then import the data. Before importing, check whether there is a definition of charset in the exported sql file. If so, it needs to be replaced with utf8.
In addition, set names utf8 must be executed immediately after PHP connects to the database.

The database also needs to be modified.

Database character set

Database character set

Connection character set, proofreading character set, transmission character set, header, character set used by database to store data

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template