JSON URL from StackExchange API returning jibberish?
- by shsteimer
I have a feeling I'm doing something wrong here, but I'm not quite sure I'f I'm missing a step, or am just having an encoding problem or something. Here's my code
URL url = new URL("http://api.stackoverflow.com/0.8/questions/2886661");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
// Question q = new Gson().fromJson(in, Question.class);
String line;
StringBuffer content = new StringBuffer();
while ((line = in.readLine()) != null)
{
content.append(line);
}
when I print content, I get a whole bunch of wingdings and special characters, basically jibberish. I would copy and past it here, but that isn't working. What am I doing wrong?