When the project is developed, the Chinese characters submitted by the Web form will be reported incorrect string value: ' \xf0\x90\x8d\x83\xf0\x90 ... ' exception
The reason is that MySQL encoding is caused by using show variables like ' character% ' to view the encoding of the database:
Mysql> Show variables like ' character%'- ;+--------------------------+--------------------------------------------------------+| variable_name | Value |+--------------------------+-------------------------------------- ------------------+| character_set_client | Latin1 | | character_set_connection | Latin1 | | Character_set_database | Latin1 | | Character_set_filesystem | binary | | Character_set_results | Latin1 | | Character_set_server | Latin1 | | Character_set_system | UTF8 | | Character_sets_dir | /usr/local/mysql-5.1.63-osx10.6-x86_64/share/charsets/|+--------------------------+--------------------------- -----------------------------+8 rows inchSet (0.00 sec)
Find some solutions online: Modify the field or the table's character set to UTF8
Scenario 1, converting the data table encoding to insert Chinese characters to UTF8
Affected rows (0.35 duplicates:0 warnings:0
Scenario 2, changing the encoding format of the database, and then re-building the table
Alert Database fruitdata character set UTF8;
MySQL inserting Chinese characters incorrect string value solution