美文网首页
解决ReportNG中文乱码

解决ReportNG中文乱码

作者: 臂力棒在想 | 来源:发表于2017-06-25 22:21 被阅读36次
    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

    相关文章

      网友评论

          本文标题:解决ReportNG中文乱码

          本文链接:https://www.haomeiwen.com/subject/cforcxtx.html