JSON URL from StackExchange API returning jibberish?

Posted by shsteimer on Stack Overflow See other posts from Stack Overflow or by shsteimer
Published on 2010-05-22T15:24:10Z Indexed on 2010/05/22 15:30 UTC
Read the original article Hit count: 368

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about JSON