备忘录:将响应的默认字符集切换为UTF-8(使用Spring Boot)

听说在Spring Boot 1.2中,将ISO-8859-1覆盖为UTF-8,所以如果是1.2之前的版本,好像只需要升级到1.2就可以了。

第一篇参考文献

    • Spring Boot 1.2 リリースノート

 

    • gh-1800 – Issue

 

    Override StringHttpMessageConverter with UTF-8 – Commit

第二篇参考文献

可能涉及的事情:
– 根据RFC,text/*的默认编码是ISO-8859-1 – tototoshi的日志
– http://stackoverflow.com/questions/20168563/spring-boot-utf-8-resources
– http://stackoverflow.com/questions/20935969/make-responsebody-annotated-spring-boot-mvc-controller-methods-return-utf-8

第三个文献的引用

那些看似有关联但实际上并无关系的东西
– http://stackoverflow.com/questions/24670446/utf-8-encoding-with-spring-boot-1-1-1
– http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#common-application-properties