[Switch] Mysql insert Chinese error: Incorrect string value: '\ xE7 \ xA8 \ x8B \ xE5 \ xBA \ x8F... for column 'Course' at row 1, what is xe5x8cx97?
Incorrect string value: '\ xE7 \ xA8 \ x8B \ xE5 \ xBA \ x8F...' for column 'Course' at row 1
The cause of this error is that the encoding format of the database is latin1, And I want to insert utf8 Chinese into the database.
Modify the database encoding at the beginning
[SQL]View plain copy
- Alter table score default character set utf8;
However, an error still occurred while inserting Chinese characters.
Then, you can view the data table Encoding
[SQL]View plain copy
- Show create table score;
As shown below:
Note that the course encoding is still latin1. Although the table encoding is utf8, I don't know why the column encoding hasn't changed.
The following is how to change the column encoding.
[SQL]View plain copy
- Alter table score change score varchar (50) character utf8;
After modification is successful
The result is that the column encoding has been modified successfully.
Next, insert utf8 to the Chinese language.
Http://blog.csdn.net/ch717828/article/details/41357431