Quick fix for detecting the encoding of the downloaded data/page. But still it need some improvement.