MySQL is prone to garbled problems when porting data containing Chinese. Many of them appeared when transplanted from mysql4.x to mysql5.x. The default character set for MySQL is Latin1, and many people use the latin1 character set when using mysql4.
Black noodle
Yesterday I met a PHP website where the database was MYSQL5.1. After the phpmyadmin management of the website, I found that all Chinese characters in the table were garbled. After export, the local import was garbled, you cannot view
Convert MYSQL databases that contain UTF8 and latin1 encoding. if someone asks me today, I just turn it around. it's very simple. here I will explain it.
Using phpmyadmin to import data to test, we found that the database contains UTF8 and latin1
Background: The dnname of a MySQL database in a system adopts the default Latin1 character set. During system upgrade, all data must be converted to UTF-8 format and the target database is newdbname (utf8 is used for database creation)
Method
Remove latin1 encoded characters from MySQL, display garbled output, PHP How to convert to UTF8 format?
Reply content:
Remove latin1 encoded characters from MySQL, display garbled output, PHP How to convert to UTF8 format?
PHP itself only
My previous database encoding is the default Latin1, but I want to convert it to utf8, Baidu, and Google for a long time. There are many methods, but many methods are either too troublesome or hard to understand.
After checking for half a day and
To sum up the problem of MYSQL encoding conversion latin1 to utf8 bitsCN.com
Black noodle
Yesterday I met a PHP website where the database was MYSQL5.1. after The phpmyadmin management of the website, I found that all Chinese characters in the table
Introduction: This is a detailed page of MySQL database encoding problem 3 (modifying the database, table, and field encoding to utf8). It introduces the related knowledge, skills, and experience of PHP, and some PHP source code.
Class = 'pingjiaf'
There is a data table on the line, the character set is UTF8, but because of the reason of the environment is not unified, causes the data table to actually store the content is the latin1 inside code the data.In other words, the data of the latin1
In MySQL, the corresponding table field encoding is usually the default lartin1 encoding, in the local client when the display is garbled, but through the mysql-u-p-h command login, select query to the data is normal, through JDBC or PHP, etc. to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.