diff --git a/java/src/main/java/com/genexus/internet/HttpClientJavaLib.java b/java/src/main/java/com/genexus/internet/HttpClientJavaLib.java index 662d47cb0..895931ccc 100644 --- a/java/src/main/java/com/genexus/internet/HttpClientJavaLib.java +++ b/java/src/main/java/com/genexus/internet/HttpClientJavaLib.java @@ -725,14 +725,17 @@ 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); - if (res.matches(".*[Ã-ÿ].*")) { - res = EntityUtils.toString(entity, StandardCharsets.UTF_8); - } eof = true; return res; } catch (IOException e) {