Skip to content

Commit 4f92ac8

Browse files
Encode using UTF-8 if return has funny characters (#904)
* Encode using UTF-8 if return has funny characters Issue:201744 * Remove funny characters fix. Encode with UTF8 by default.
1 parent d20ab4e commit 4f92ac8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

java/src/main/java/com/genexus/internet/HttpClientJavaLib.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,9 +725,15 @@ public String getString() {
725725
return "";
726726
try {
727727
this.setEntity();
728-
Charset charset = ContentType.getOrDefault(entity).getCharset();
729-
if (charset == null) {
728+
ContentType contentType = ContentType.getOrDefault(entity);
729+
Charset charset;
730+
if (contentType.equals(ContentType.DEFAULT_TEXT)) {
730731
charset = StandardCharsets.UTF_8;
732+
} else {
733+
charset = contentType.getCharset();
734+
if (charset == null) {
735+
charset = StandardCharsets.UTF_8;
736+
}
731737
}
732738
String res = EntityUtils.toString(entity, charset);
733739
eof = true;

0 commit comments

Comments
 (0)