DEV Community

shubhamgarg
shubhamgarg

Posted on

 

Multi-language character support in Thymeleaf

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
</head>

<!--<body style="width: 900px; margin: 0 auto; color: #111; font-family: Arial Unicode MS; font-size: 12px;-->
<!--    line-height: normal; box-sizing: border-box;">-->
<body style="font-family: Barlow">

<div>
    Sample test text
    tiếng Việt
</div>

</body>
</html>
Enter fullscreen mode Exit fullscreen mode
templateEngine.process("template.html", context);

Enter fullscreen mode Exit fullscreen mode

I am using this template.html file with Vietnamese text in it
and trying to generate pdf from it by using Thymeleaf.TemplateEngine
but,
text is comming like this in pdf

Sample test text ti?ng Vi?t

Vietnamese characters are not comming properly

Top comments (0)

Super Useful CSS Resources

A collection of 70 hand-picked, web-based tools which are actually useful.
Each will generate pure CSS without the need for JS or any external libraries.