Reputation: 107
I am trying to get response from a website. I am using HttpURLConnection
class.
this is my code:
BufferedReader in = null;
in = new BufferedReader(new InputStreamReader(httpCon.getInputStream()));
String Line;
while ((Line= in.readLine()) != null) {
System.out.println(Line);
}
All I get is :"�Q�u����0�_������q�J��R衔�J1�4q�Ȓ��d�%�ޑl/��^�0�ϯ�7�[6@~Ȟ�K��S��+u"
How can I decode it? Thank you.
Upvotes: 2
Views: 101
Reputation: 94479
The request is most likely GZipped. Use a GZIPInputStream
to read the request.
BufferedReader in = null;
in = new BufferedReader(new InputStreamReader(new GZIPInputStream(httpCon.getInputStream())));
String Line;
while ((Line= in.readLine()) != null) {
System.out.println(Line);
}
Upvotes: 2