Java: Reading From A Url Produces Gibberish
So I've been trying to read the html code from kickass.to(it works fine on other sites) but all I get is some weird gibberish. My code: BufferedReader in = new BufferedReader(
Solution 1:
The problem here is a server that is probably not configured correctly, as it returns its response gzip compressed, even if the client does not send an Accept-Encoding: gzip
header.
So what you're seeing is the compressed version of the page. To decompress it, pass it through a GZIPInputStream:
BufferedReaderin=newBufferedReader(
newInputStreamReader(
newGZIPInputStream(newURL("http://kickass.to/").openStream())));
Post a Comment for "Java: Reading From A Url Produces Gibberish"