diff --git a/java/src/main/java/com/genexus/internet/HttpClientJavaLib.java b/java/src/main/java/com/genexus/internet/HttpClientJavaLib.java index a3fd0de21..895931ccc 100644 --- a/java/src/main/java/com/genexus/internet/HttpClientJavaLib.java +++ b/java/src/main/java/com/genexus/internet/HttpClientJavaLib.java @@ -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;