Coding error at open URL
Posted
by
Lobo
on Stackapps
See other posts from Stackapps
or by Lobo
Published on 2010-12-09T11:25:56Z
Indexed on
2010/12/27
1:58 UTC
Read the original article
Hit count: 653
Hi,
I have the following method to open a URL API
String c="";
URL direccionURL;
try {
direccionURL = new URL("http://api.stackoverflow.com/1.0/users/523725");
BufferedReader in = new BufferedReader(new InputStreamReader(
direccionURL.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
c+=inputLine;
in.close();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return c;
In the end, the "c" variable contains a set of characters that are not the same I get if I open the same URL with a browser. Why?, What am I doing wrong?
Thank's for help.
Regards!
© Stackapps or respective owner