输出流问题:修改Writer如下:

OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(dir), "UTF-8");  
PrintWriter printWriter = new

模板页面问题,在模板页面中添加:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

freemark没有设置编码格式,修改配置文件:

<bean id="freemarkerConfig"
class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<property name="templateLoaderPath" value="/WEB-INF/ftl/" />
<property name="defaultEncoding" value="UTF-8" />
</bean>

乱码解决。

唯有热爱方能抵御岁月漫长。