OpenJPA and MySQL store incorrect encoded characters

my mysql db has utf8 character encoding. In QueryBrowser, I see that special characters are true. In an application using openjpa, I can see the same values ​​as the correct ones. But when I save the object in the database, I have the correct values ​​in the application, but the wrong ones in the database! When I restart the application, that special characters in the application are incorrect. (Since they are selected from the database)

Everything is installed in UTF-8, the Java application works well, reading data from the database is correct, but the problem is when openjpa stores the values ​​in the database, they turn into '?'.

Any ideas? Thanks

+3
source share
1 answer

Check your encoding at the MySql server configuration level ( my.cnffile), as well as at the specific database level. Once I had a similar problem when these two parameters were set to different values ​​(encodings).

0
source

Source: https://habr.com/ru/post/1749282/


All Articles