解决reportNG中文乱码(转:http://www.it610.com/article/3626590.htm)
2016-09-30 11:13
253 查看
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中文乱码
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中文乱码
相关文章推荐
- MySQL 插入数据时,中文乱码问题的解决http://www.cnblogs.com/sunzn/archive/2013/03/14/2960248.html
- 中式与西式网页设计的差别http://www.backboneitgroup.com/china-search-differences.htm
- Ajax编码和Ajax乱码解决http://www.ad0.cn/netfetch/article.asp?id=658
- HttpClient4入门应用----抓取网站内容(解决中文乱码)
- httpclient3解决post中文乱码
- 解决在url中传递js变量到java程序中出现乱码问题(转自http://www.blogjava.net/fine)
- android开发时,http提交地址中有中文乱码的解决方法
- SecureCRT中文乱码解决方案(http://www.bootf.com/547.html)-开始学习使用linux
- http://www.mldn.cn/articleview/2009-4-3/article_view_3064.htm MLDN
- httpclient中文乱码解决
- 管道的另一端上无任何进程 http://www.itzhe.cn/article/20080125/62542.html
- SVN+Apache在windows下http访问 显示中文乱码问题的解决方法
- 让Notepad++变成一个轻量级的C/C++编译器 - 电脑狂 - IT世界 http://www.itlodge.net/article/121.html
- XMLHttpRequest读取中文网页时返回乱码的解决办法
- httpClient中文乱码问题解决(wap提交)
- 解决XMLHttpRequest中文乱码问题
- 解决CXRICHEDIT中文乱码问题
- ASIHttpRequest中Post中文乱码解决
- android http post 中文乱码解决
- VC编程常见类型变量 ZT(http://www.vckbase.com/study/article/data_convert.htm)