Merge pull request #4834 from esaunders/4936-utf8-files-report

Use UTF8 encoding for report content.
This commit is contained in:
Richard Cordovano 2019-06-04 14:17:48 -04:00 committed by GitHub
commit 77e35fd9f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@ -63,9 +64,12 @@ class FileReportText implements FileReportModule {
public void startReport(String baseReportDir) {
this.reportPath = baseReportDir + FILE_NAME;
try {
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(this.reportPath)));
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(this.reportPath), StandardCharsets.UTF_8));
out.write('\ufeff');
} catch (FileNotFoundException ex) {
logger.log(Level.WARNING, "Failed to create report text file", ex); //NON-NLS
} catch (IOException ex) {
logger.log(Level.WARNING, "Failed to write BOM to report text file", ex); //NON-NLS
}
}