thymeleaf / thymeleaf-docs

Thymeleaf documentation
Apache License 2.0
44 stars 54 forks source link

Use UTF-8 as charset in ThymeleafViewResolver #6

Closed msulima closed 10 years ago

msulima commented 10 years ago

Since UTF-8 is standard in modern programming world, it's a shame that non-English users of Thymeleaf, which follow this tutorial, have to spend 15 minutes googling to make templates work in their native language.

danielfernandez commented 10 years ago

Hey, I'm the author of the thing and I'm not an English-speaker ;-)

Actually, you don't need to set that characterEncoding property to UTF-8 in order to use non-English languages. Only if you want to directly use non-ISO-8859-1 characters -that is the default encoding- directly in your templates (instead of an externalized messages file).

Of course, many languages need characters outside ISO-8859-1, and in such case you are right that you would need to either change that characterEncoding setting to UTF-8, or use an externalized messages file. But ISO-8859-1 is used as the default because it actually is the default in Spring MVC. So Thymeleaf (and this tutorial) simply respects this...