码迷,mamicode.com
首页 > Web开发 > 详细

解决reportNG中文乱码(转:http://www.it610.com/article/3626590.htm)

时间:2016-09-30 12:27:14      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:

1.下载reportng源码
     git clone  https://github.com/dwdyer/reportng.git
2.修改AbstractReporter.java
     package org.uncommons.reportng;
     ...
     import java.io.OutputStream;
     ...
     protected void generateFile(File file,
                                String templateName,
                                VelocityContext context) throws Exception
    {
        //Writer writer = new BufferedWriter(new FileWriter(file));
        //encoding to utf-8
        OutputStream out = new FileOutputStream(file);
        Writer writer = new BufferedWriter(new OutputStreamWriter(out,"utf-8"));
        try
        {
            Velocity.mergeTemplate(classpathPrefix + templateName,
                                   ENCODING,
                                   context,
                                   writer);
            writer.flush();
        }
        finally
        {
            writer.close();
        }
    }
3.编译源码
     cd reportng
     ant
 
PS:ant环境配置
1.下载ant源码包
      http://ant.apache.org/bindownload.cgi
2.解压到安装位置
     unzip to D:\apache-ant-1.9.6
3.修改环境变量
     set ANT_HOME      D:\apache-ant-1.9.6
     set Path                  %ANT_HOME%\bin
4.验证ant
     cmd:ant -version
技术分享

解决reportNG中文乱码

解决reportNG中文乱码(转:http://www.it610.com/article/3626590.htm)

标签:

原文地址:http://www.cnblogs.com/dayiran1222/p/5923222.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!