Skip to content

Commit 305dc0d

Browse files
tomas-sexenianBeta Bot
authored andcommitted
Revert branch 'genexuslabs:FunnyFix' into beta
1 parent b8f9a96 commit 305dc0d

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -702,16 +702,23 @@ public String getString() {
702702
return "";
703703
try {
704704
this.setEntity();
705-
Charset charset = ContentType.getOrDefault(entity).getCharset();
706-
String res = EntityUtils.toString(entity, charset);
707-
if (res.matches(".*[Ã-ÿ].*")) {
708-
res = EntityUtils.toString(entity, StandardCharsets.UTF_8);
705+
ContentType contentType = ContentType.getOrDefault(entity);
706+
Charset charset;
707+
if (contentType.equals(ContentType.DEFAULT_TEXT)) {
708+
charset = StandardCharsets.UTF_8;
709+
} else {
710+
charset = contentType.getCharset();
711+
if (charset == null) {
712+
charset = StandardCharsets.UTF_8;
713+
}
709714
}
715+
String res = EntityUtils.toString(entity, charset);
710716
eof = true;
711717
return res;
712718
} catch (IOException e) {
713719
setExceptionsCatch(e);
714-
} catch (IllegalArgumentException e) {}
720+
} catch (IllegalArgumentException e) {
721+
}
715722
return "";
716723
}
717724

0 commit comments

Comments
 (0)