Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

Commit

Permalink
Force UTF-8 encoding when parsing an HTTP entity into an XML document (
Browse files Browse the repository at this point in the history
…#762)

- This avoids issues on systems that don't use UTF-8 locales by default (Windows, mainly)
  • Loading branch information
ggalmazor authored Jul 11, 2019
1 parent 5bc43ed commit 91f5f85
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/org/opendatakit/briefcase/reused/http/RequestBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -108,10 +107,10 @@ private static String readString(InputStream in) {
}

private static XmlElement readXmlElement(InputStream in) {
try (InputStreamReader ir = new InputStreamReader(in)) {
try (InputStream in2 = in) {
Document doc = new Document();
KXmlParser parser = new KXmlParser();
parser.setInput(ir);
parser.setInput(in2, UTF_8.name());
parser.setFeature(FEATURE_PROCESS_NAMESPACES, true);
doc.parse(parser);
return XmlElement.of(doc);
Expand Down

0 comments on commit 91f5f85

Please sign in to comment.