且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

春天 - 百里香 - 雄猫 ->无法正确处理 UTF-8 字符

更新时间:2023-01-01 11:53:14

您应该尝试将 utf 添加到 thymeleaf 视图解析器:

You should try to add utf to thymeleaf view resolver:

Bean
public ThymeleafViewResolver viewResolver() {
    ThymeleafViewResolver thymeleafViewResolver = new ThymeleafViewResolver();
    thymeleafViewResolver.setTemplateEngine(templateEngine());
    thymeleafViewResolver.setCharacterEncoding("UTF-8");
    return thymeleafViewResolver;
}