I've got a nasty problem with my Java Annotation:
@Pattern(regexp = "(...)", message = "(...) Tekst in Polish (...)")
private String ip;
This is linked to my view using BindingResult and Thymeleaf:
<p th:if="${#fields.hasErrors('ip')}" class="error" th:errors="*{ip}"></p>
However, even though my entire page is in UTF-8 and text is displayed correctly, annotation is encoded improperly. I cannot reproduce it on my local machine, it happens only on my client's server. On both servers, file.encoding
is equal to UTF-8
. Thymeleaf configuration is set to use UTF-8 as well, Spring is configured to use UTF-8
too:
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
How can I fix this issue? Thanks for all replies.
Solution: I moved the solution to another post below.