Template template = freemarkerCfg.getTemplate(htmlTmp); template.setEncoding(“UTF-8”); 这里的编码与html中的编码对应。但转换还是乱码。 解决方案 配置Configuration的时候 添加 freemarkerCfg.setEncoding(Locale.CHINA, “UTF-8”); 即在进行转换前,还需要指定一下配置类中编码。