Skip to content

Commit

Permalink
Encode using UTF-8 if return has funny characters (#904)
Browse files Browse the repository at this point in the history
* Encode using UTF-8 if return has funny characters
Issue:201744

* Remove funny characters fix. Encode with UTF8 by default.
  • Loading branch information
tomas-sexenian authored Oct 21, 2024
1 parent d20ab4e commit 4f92ac8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions java/src/main/java/com/genexus/internet/HttpClientJavaLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,15 @@ public String getString() {
return "";
try {
this.setEntity();
Charset charset = ContentType.getOrDefault(entity).getCharset();
if (charset == null) {
ContentType contentType = ContentType.getOrDefault(entity);
Charset charset;
if (contentType.equals(ContentType.DEFAULT_TEXT)) {
charset = StandardCharsets.UTF_8;
} else {
charset = contentType.getCharset();
if (charset == null) {
charset = StandardCharsets.UTF_8;
}
}
String res = EntityUtils.toString(entity, charset);
eof = true;
Expand Down

0 comments on commit 4f92ac8

Please sign in to comment.