解决ReportNG中文乱码

  1. 下载ReportNg源码
git clone  https://github.com/dwdyer/reportng.git
  1. 修改AbstractReporter.java(该文件的所在目录为xxx\reportng\reportng\src\java\main\org\uncommons\reportng
    protected void generateFile(File file,
                                String templateName,
                                VelocityContext context) throws Exception
    {
        // Writer writer = new BufferedWriter(new FileWriter(file));
        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 # 进入目录xxx\reportng\reportng
ant # 若无ant,则需搭建

参考:
http://www.it610.com/article/3626590.htm

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容