Skip to content

Commit 0252dc8

Browse files
Remove funny characters fix. Encode with UTF8 by default.
1 parent ee5b813 commit 0252dc8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -725,14 +725,17 @@ 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);
733-
if (res.matches(".*[Ã-ÿ].*")) {
734-
res = EntityUtils.toString(entity, StandardCharsets.UTF_8);
735-
}
736739
eof = true;
737740
return res;
738741
} catch (IOException e) {

0 commit comments

Comments
 (0)