I use charset UTF-8. It works fine with a code like the one below, correctly displaying the "çã" characters of the word "coração".
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<form>
coração
</form>
</body>
</html>
But if I move that code into a thymeleaf fragment such as below, the encoding stops working and strange characters are displayed.
testfragment.html
<div th:fragment="testfragment">
coração
</div>
test.html (inserts the code from testfragment.html)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<form>
<div th:replace="testfragment.html :: testfragment"></div>
</form>
</body>
</html>
How to make charset work when using thymeleaf fragments?