Below method is designed to get source code of html page of given url, but it returns result in different charset in each call (in every call argument url is same), please, explain me why?
private String getSourceCode(URL url) {
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel MacOS X 10.4; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2");
return IOUtils.toString(conn.getInputStream());
}
...y??????Ywmm?Vs??B?0?/M??gJ?l?p.??n.??pBo??N...second call: normal html code url:http://habrahabr.ru/post/266163/