Today, a friend asked me about the problem of storing Chinese garbled characters in the database.
As shown in the figure:
I took a look at his project, and everything from the page to the project to the server is in utf-8 format, so I guess the database encoding is incorrect. Checking the database encoding, it is not utf-8.
then change the encoding
Originally I thought it was over here , but it didn't , and his database connection method was not utf-8 by default. But his xml url configuration is the simplest " jdbc:mysql://localhost:3306/xxx " .
I just.... So if you don't change the database, you can only modify the url first and change it to " jdbc:mysql://localhost:3306/xxx?useUnicode=true&characterEncoding=UTF-8 ", everything will be fine.