简体   繁体   中英

Can't change encoding of freemarker template to UTF-8 in spring framework

I can't change the encoding to UTF-8, even if I explicitly specify it. Page in browser always created with encoding ISO-8859-1 and my language symbols show as "???". If it important - i'm use IntelliJ IDEA.

It's problem with freemarker because when I change it to jsp, pages generate with encoding UTF-8.

I tried to change encoding with:

  1. Check encoding in IDE
  2. <#ftl encoding>
  3. <#setting url_escaping_charset="UTF-8">
  4. <#setting output_encoding="UTF-8">
  5. specify produces parameter in @....Mapping annotations
  6. Specify encoding in FreeMarkerConfigurer
  7. Specify content type in FreeMarkerResolver
  8. Specify encoding in CharacterEncodingFilter
  9. Specify encoding in implementation of Filter
  10. Specify content type in FreeMarkerConfigurerFactory

But nothing of it didn't give me a solution

Result in browser

Freemarker template

Project in gitHub

我找到了解决方案-当我们实现WebMvcConfigurer并使用Registry.freemarker时,Spring自己配置了freemarker,而我们的bean FreemarkerViewResolver&Configurer并没有影响任何事情。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM