Skip to content

Commit ee27aeb

Browse files
iroquetaBeta Bot
authored andcommitted
Cherry pick branch 'genexuslabs:GetStringConentType' into beta
1 parent 33b92fb commit ee27aeb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -742,11 +742,12 @@ public String getString() {
742742
return "";
743743
try {
744744
this.setEntity();
745-
Charset charset = ContentType.getOrDefault(response.getEntity()).getCharset();
745+
ContentType contentType = ContentType.getOrDefault(response.getEntity());
746+
Charset charset = contentType.getCharset() != null
747+
? contentType.getCharset()
748+
: StandardCharsets.UTF_8;
749+
746750
String res = EntityUtils.toString(entity, charset);
747-
if (res.matches(".*[Ã-ÿ].*")) {
748-
res = EntityUtils.toString(entity, StandardCharsets.UTF_8);
749-
}
750751
eof = true;
751752
return res;
752753
} catch (IOException e) {

0 commit comments

Comments
 (0)