Today, I wrote a group buying website trainer who used the S2SH big integration. It was a bit exciting, but there were a lot of troubles. After all, what I did for the first time? This log is about a big acquaintance, incorrect string value: 'xe6x9bxb9xe5x86xac... 'for column 'realname' at row 1, hey, I 've seen a lot before.
The following error occurs when you enter Chinese characters.
I understand that this error occurs. In all likelihood, there is a problem with the encoding of the database tutorial. I was too lazy to study it before. I was lucky to write a Syso in the background to check whether the console output was garbled and the result showed that it was normal, if there are no garbled characters, it is definitely a database encoding problem.
Mysql tutorial database I used, Version 5.1.
Use show variables like 'character % 'to view the database encoding. latin1 is expected.
If the project is being tested and the data is not important, the solution is to use alert database tuanplus character set utf8 to change the encoding format of the database, and then create a new table (in Hibernate, specify hibernate. hbm2ddl. auto = create, re-deploy the project, hibernate will automatically re-create the table), view the database code at this time, hey, it's utf8. Exception relief.
If the data in the project is important data, there is still a solution.
To use alter table address convert to character set utf8 to convert the data table that needs to be inserted into Chinese characters, encode it as utf8 (in this example, the data table is address ):
Back up data in advance to avoid exceptions