From e63f94dc3f21f52ee4178a9c427159c87553a148 Mon Sep 17 00:00:00 2001 From: shuzheng <469741414@qq.com> Date: Thu, 4 May 2017 22:05:11 +0800 Subject: [PATCH] =?UTF-8?q?@laywee=20=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E6=97=B6=E6=9C=89=E6=97=B6?= =?UTF-8?q?=E4=B9=B1=E7=A0=81=E5=AF=BC=E8=87=B4maven=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E6=89=93=E5=8C=85=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/zheng/common/util/VelocityUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zheng-common/src/main/java/com/zheng/common/util/VelocityUtil.java b/zheng-common/src/main/java/com/zheng/common/util/VelocityUtil.java index 21d49e02..f28675bb 100644 --- a/zheng-common/src/main/java/com/zheng/common/util/VelocityUtil.java +++ b/zheng-common/src/main/java/com/zheng/common/util/VelocityUtil.java @@ -1,5 +1,6 @@ package com.zheng.common.util; +import org.apache.commons.io.output.FileWriterWithEncoding; import org.apache.commons.lang.StringUtils; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; @@ -7,7 +8,6 @@ import org.apache.velocity.app.Velocity; import org.apache.velocity.app.VelocityEngine; import java.io.File; -import java.io.FileWriter; import java.util.Properties; /** @@ -31,7 +31,7 @@ public class VelocityUtil { //VelocityEngine engine = new VelocityEngine(); Template template = Velocity.getTemplate(getFile(inputVmFilePath), "utf-8"); File outputFile = new File(outputFilePath); - FileWriter writer = new FileWriter(outputFile); + FileWriterWithEncoding writer = new FileWriterWithEncoding(outputFile, "utf-8"); template.merge(context, writer); writer.close(); } catch (Exception ex) {