I would not suggest richies answer, because is screwing up the data inside the database. You would don't fix your problem but try to "hide" it and not being able to perform essential database operations with the C rapped data.
If you encounter this error either the data "is" sending is not UTF-8 encoded, or your connection was not UTF-8. First, verify, that the data source (a file, ...) really is UTF-8.
Then, check your The database connection, you should do the after connecting:
SET NAMES ‘utf8‘;SET CHARACTER SET utf8;
Next, verify the tables where the data is stored has the UTF8 character set:
SELECT `Tables`.`table_name`, `Collations`.`Character_set_name`From `Information_schema`.`TABLES` As `Tables`, `Information_schema`.`Collation_character_set_applicability` As ' collations ' ' tables '. ' table _schema = database< Span class= "pun" > () and collations "collation_name = ' tables '. ' table_collation '
Last, check your database settings:
mysql> show variables like ‘%colla%‘;mysql> show variables like ‘%charac%‘;
If source, transport and destination are UTF-8, your problem is gone;)
Also, after installing MySQL, you should run a command to set the encoding to Utf-8:
Run at the command line first: status to see if the encoding is UTF8.
Set character_set_server = ' UTF8 '; set character_set_connection = ' UTF8 '; set character_set_results = ' UTF8 '; set character _set_client = ' UTF8 '; Change database encoding can be used: ALTER DATABASE db_name default character set ' UTF8 ';
Show create table T1; You can view the schema of the table
MySQL Chinese garbled solution