The root cause of the garbled problem is that the encoding is not uniform. Since the project had no Chinese garbled characters before the database was reloaded, the problem must have occurred in the database encoding. After running mysql, enter the following command showvariableslikecharacter %; the author's query result is as follows: among them, character_set_client client Encoding
The root cause of the garbled problem is that the encoding is not uniform. Since the project had no Chinese garbled characters before the database was reloaded, the problem must have occurred in the database encoding. After running mysql, enter the following command show variables like 'character % '. The query result is as follows:
The root cause of the garbled problem is that the encoding is not uniform. Since the project had no Chinese garbled characters before the database was reloaded, the problem must have occurred in the database encoding.
After running mysql, enter the following command
Show variables like 'character % ';
The author's query results are as follows:
The character_set_client client encoding method;
Character_set_connection indicates the encoding used to establish a connection;
Character_set_database database encoding;
Character_set_results result set encoding;
Character_set_server database server code;
As long as the above four encoding methods are the same, there will be no garbled problem. It can be seen that the author's database is indeed prone to Encoding Problems .. The solution is also simple. You can add this to the database connection configuration file of each project.
Jdbc: mysql: // localhost: 3306/databasename? UseUnicode = true & characterEncoding = UTF-8
Or
Jdbc: mysql: // localhost: 3306/databasename? UseUnicode = true & characterEncoding = UTF-8
You can select one of them based on different XML parsing tools.