Change encoding to UTF-8 in reports for dashboard.

Bugzilla Id: 59889


git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1754436 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Felix Schumacher 2016-07-28 17:36:07 +00:00
parent c73a84dc9f
commit f933590417
3 changed files with 13 additions and 4 deletions

View File

@ -25,8 +25,11 @@ import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import org.apache.commons.lang3.Validate;
import org.apache.jmeter.save.SaveService;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.jorphan.util.JOrphanUtils;
/**
@ -45,7 +48,9 @@ abstract public class AbstractSampleWriter extends SampleWriter {
private static final int BUF_SIZE = 10000;
private static final String CHARSET = "ISO8859-1";
private static final String CHARSET = SaveService.getFileEncoding(StandardCharsets.UTF_8.displayName());
private static org.apache.log.Logger log = LoggingManager.getLoggerForClass();
/** output writer to write samples to */
protected PrintWriter writer;
@ -72,7 +77,8 @@ abstract public class AbstractSampleWriter extends SampleWriter {
/**
* Instructs this sample writer to write samples on the specified output
* with ISO8859-1 encoding
* with UTG-8 encoding. The encoding can be overriden by the user through
* {@link SaveService#getFileEncoding(String)}
*
* @param out
* The output stream on which sample should be written
@ -83,7 +89,7 @@ abstract public class AbstractSampleWriter extends SampleWriter {
try {
setWriter(new OutputStreamWriter(out, CHARSET));
} catch (UnsupportedEncodingException e) {
// ignore iso8859-1 always supported
log.warn("Unsupported CHARSET: " + CHARSET, e);
}
}

View File

@ -25,9 +25,11 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import org.apache.jmeter.samplers.SampleSaveConfiguration;
import org.apache.jmeter.save.CSVSaveService;
import org.apache.jmeter.save.SaveService;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.jorphan.util.JOrphanUtils;
@ -46,7 +48,7 @@ public class CsvSampleReader implements Closeable{
private static final Logger LOG = LoggingManager.getLoggerForClass();
private static final int BUF_SIZE = 10000;
private static final String CHARSET = "ISO8859-1";
private static final String CHARSET = SaveService.getFileEncoding(StandardCharsets.UTF_8.displayName());
private static final char DEFAULT_SEPARATOR =
JMeterUtils.getPropDefault("jmeter.save.saveservice.default_delimiter", ",").charAt(0); //$NON-NLS-1$ //$NON-NLS-2$

View File

@ -175,6 +175,7 @@ Summary
<li><bug>59722</bug>Use StandardCharsets to reduce the possibility of misspelling Charset names.</li>
<li><bug>59723</bug>Use jmeter.properties for testing whenever possible</li>
<li><bug>59726</bug>Unit test to check that CSV header text and sample format don't change unexpectedly</li>
<li><bug>59889</bug>Change encoding to UTF-8 in reports for dashboard.</li>
</ul>
<!-- =================== Thanks =================== -->