I have made a simple form where a user enters a name and then this name is stored in the database. I'm using Spring MVC
and Thymeleaf
. My database is MySQL
. The problem occurred when I was trying to enter non-latin characters.
After storing the non-latin name
in the database, I tried to display it on the webpage, but instead of cyrillic characters I got strange characters like this:
ИмÑ
- I'm sure that encoding in the database is correct because when I tried to
store a non-latin name using
MySQL Workbench
the encoding was right. - Thymeleaf encoding is also set to UTF-8. Non-lating characters are displayed correctly when I put them, for example, in a tag like this:
<h1> Заголовок </h1>
I have already tried:
- adding this line in the html file:
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
- adding this attribute in the
form
tag:<form accept-charset="UTF-8" ...
But nothing works. What am I doing wrong?