Skip to content

Commit

Permalink
use UTF-8 to encode strings, Github spotbugs#82
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrawnCA authored and henrik242 committed Sep 4, 2017
1 parent 61ff29b commit fe81252
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

import org.junit.Test;

Expand Down Expand Up @@ -90,8 +91,7 @@ private String writeXMLAndGetStringOutput(NotMatcher notMatcher) throws IOExcept
notMatcher.writeXML(xmlOutput, false);
xmlOutput.finish();

String xmlOutputCreated = outputStream.toString();
return xmlOutputCreated;
return outputStream.toString(StandardCharsets.UTF_8.name());
}

private static class TestMatcher implements Matcher {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

import org.apache.tools.ant.filters.StringInputStream;
import org.junit.Before;
Expand Down Expand Up @@ -122,7 +123,7 @@ private String writeXMLAndGetStringOutput(SourceMatcher matcher, boolean disable
matcher.writeXML(xmlOutput, disabled);
xmlOutput.finish();

return outputStream.toString().trim();
return outputStream.toString(StandardCharsets.UTF_8.name()).trim();
}


Expand Down

0 comments on commit fe81252

Please sign in to comment.