I'm trying to get an HTML response from a remote website, and I get something like this :
ס×?×? ×?×? ×?×? ×?×?
instead of Hebrew letters or symbols.
Here is my code:
CloseableHttpClient httpclient = HttpClients.custom()
.setDefaultCookieStore(cookieStore)
.build();
HttpGet httpget = new HttpGet(URL);
CloseableHttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
String s=null;
if (entity != null) {
s= EntityUtils.toString(entity);
}
Does anyone know what the problem is?
As per the docs,
The default charset is being used because you don't provide one, which doesn't map those characters correctly - you should probably use UTF-8 instead. Try this.