extentreports-java
extentreports-java copied to clipboard
3.0.6Version AppendExisting mode,the second addition to the encoding of non-custom encoding
ExtentHtmlReport3.0.6, HtmlReport additional mode, combined with jmeter use, Report contains Chinese, HtmlReport configuration is as follows:
HtmlReporter.config (). SetEncoding ("gbk");
HtmlReporter.setAppendExisting (true);
The first time to generate a report, Report can be displayed correctly in Chinese, the second time additional Chinese characters garbled.
The first time to show Chinese as follows: "线程组1 1-1 May 26, 2017 11:40:55 AM 0h 0m 0s+485ms".
The second time to show Chinese as follows: "?????1 1-1 May 26, 2017 11:39:40 AM 0h 1m 15s+463ms".
Hello. Can you try with this commit and let me know if it works?
https://github.com/anshooarora/extentreports-java/commit/d6bbade98ff18491b9c86bf2c2c7f544fd729abb
commit d6bbade98ff18491b9c86bf2c2c7f544fd729abb Author: Anshoo Arora [email protected] Date: Sat Jul 8 14:03:07 2017 -0400
reference #885 - parse charset and apply to Jsoup document
commit b4c24a46e92d09eabfad2e09160cabcb863a07fc
I have repackaged it, but not works,the problem is the same
Can you share a sample result.html file with me to test?
Can you tell me your email address?
Hello - please check your email for followup on this ticket, you should see my email address there.
Mail has been sent, can you receive it?
Please test with this https://github.com/anshooarora/extentreports-java/commit/6528aa9298b44d98b4415a934b87aa6c62ed094a. I am able to maintain the same charset after appendExisting. Note: I used gbk charset for my test.
commit 6528aa9298b44d98b4415a934b87aa6c62ed094a Author: Anshoo Arora [email protected] Date: Fri Aug 11 12:28:36 2017 -0400
fix #885 - parsing charset issue
I have repackaged it, but not works,the problem is the same
What is the charaset after you create the report? What is the charset after you append?
private static void createExtentReports(String fileName, String isAppend) { extent = new ExtentReports(); extent.setSystemInfo("Tool", "Jmeter"); extent.attachReporter(createHtmlReporter(fileName, isAppend));
}
private static ExtentHtmlReporter createHtmlReporter(String fileName, String isAppend) { ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(fileName); htmlReporter.config().setChartVisibilityOnOpen(false); htmlReporter.config().setTestViewChartLocation(ChartLocation.BOTTOM); htmlReporter.config().setTheme(Theme.STANDARD); htmlReporter.config().setEncoding("gbk"); htmlReporter.config().setReportName("Jmeter Interface Testing"); htmlReporter.config().setDocumentTitle("Interface Testing"); htmlReporter.setAppendExisting(Boolean.valueOf(isAppend));
return htmlReporter;
}
It's all GBK
What is the charset after append? Does it revwrt to utf-8?
GBK,after append also GBK first displayed “中文乱码question8851”,after append displayed “????????question885”
Where can I get the extenterpports debug log file? or How to output the log to the specified location
I know how to solve the problem, The first step to the java System property "file.encoding" = utf-8, The second step is to set the code htmlReporter.config (). SetEncoding ("UTF-8"); The third step is to modify the source code of version 3.1.2, the code is as follows:
Writer.java
public synchronized void write (final File file, String text, String charset) {
System.out.println (charset);
try (BufferedWriter writer = new BufferedWriter (new OutputStreamWriter (new FileOutputStream (file), charset))) {
writer.write (text);
}
catch (Exception e) {
logger.log (Level.SEVERE, file.getPath (), e);
}
}
ExtentHtmlReporter.java
... flush () {
...
Writer.getInstance (). Write (new File (filePath), extentSource, userConfig.getEncoding ());
}
Set the font encoding but also the synchronization file encoding format, and then no problem.