0

I have a Spring App with Tomcat and MySql who runs with no problems in Windows, but when it's running on Linux server, special utf-8 characters (like spanish Ñ) are saved in Mysql table with the ? symbol. If I change this character directly on the database, it's correctly showed by the app. It's when I save the object using the app when the Ñ is replaced by the ?

Other apps are running on the same server and they don't have this issue. The data base has the UTF-8 charset/collation.

Can anybody help? Thanks a million!

Newbie83
  • 25
  • 8
  • Maybe read this [UTF-8 All The Way Through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through) it may give you some clues – RiggsFolly Dec 31 '20 at 10:31
  • See "question mark" in https://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored – Rick James Jan 01 '21 at 01:33

2 Answers2

0

Make sure your Datasource URL includes UTF-8 character encoding!

Example:

jdbc:mysql://localhost:3306/databaseName?useUnicode=yes&characterEncoding=UTF-8
İsmail Y.
  • 3,579
  • 5
  • 21
  • 29
  • 1
    Yes! Thank you very much!! I couldn't set exactly that way because I have a XML file instead of a properties file, but that was the solution. Thank you!!! – Newbie83 Jan 01 '21 at 08:54
0

you have to put the right encoding in your properties file or in your DataSource URL. (characterEncoding=UTF-8)