for my web app (spring boot + thymeleaf) i use message_fr.properties file witch contains some special characters converted to html
the problem comes when i display the error validation message in lang=fr
:
<span th:if="${#fields.hasErrors('title')}" th:errors="*{title}"></span>
assume that key/value are : NotEmpty.item.title = Ne doit pas être null
on screen it displays the error message without conversion : Ne doit pas être null
how can i resolve it ?
th:errors
will escape HTML in the same way that th:text
does. Before 3.0.8, you would have to iterate over the errors like this:
<span th:if="${#fields.hasErrors('title')}" th:each="err : ${#fields.errors('title')}"></span>
However, post 3.0.8, Thymeleaf-Spring includes th:uerrors
for unescaped error messages to the same effect:
<span th:uerrors="*{title}"></span>