title: Opening XML file in Android with inputstream
body: <p>I have a file called <code>products.xml</code> in res/xml/products.xml with this XML data:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;products&gt;
      &lt;product&gt;     
          &lt;productname&gt;Jeans&lt;/productname&gt;
          &lt;productcolor&gt;red&lt;/productcolor&gt;
          &lt;productquantity&gt;5&lt;/productquantity&gt;
      &lt;/product&gt;
      &lt;product&gt;     
          &lt;productname&gt;Tshirt&lt;/productname&gt;
          &lt;productcolor&gt;blue&lt;/productcolor&gt;
          &lt;productquantity&gt;3&lt;/productquantity&gt;
      &lt;/product&gt;
      &lt;product&gt;     
          &lt;productname&gt;shorts&lt;/productname&gt;
          &lt;productcolor&gt;green&lt;/productcolor&gt;
          &lt;productquantity&gt;4&lt;/productquantity&gt;
      &lt;/product&gt;
  &lt;/products&gt;
  </code></pre>
  
  <p>and my main goal is to parse it using XMLPullParser. But I'm getting a weird output when I try to open the file. Here is the code I am using:</p>
  
  <pre><code>    BufferedReader in = null;
      try {
          in = new BufferedReader(new InputStreamReader(appContext
                  .getResources().openRawResource(R.xml.products), "UTF-8"));
      } catch (UnsupportedEncodingException e) {
          e.printStackTrace();
      } catch (NotFoundException e) {
          e.printStackTrace();
      }
  
      StringBuilder s = new StringBuilder();
      String line;
      while ((line = in.readLine()) != null) {
          s.append(line);
      }
  
      System.out.println("String: " + s);
  </code></pre>
  
  <p>and I'm getting a strange output with a bunch of these characters:</p>
  
  <pre><code>�������������������������������������������������������������������
  </code></pre>
  
  <p>What am I doing wrong? Thanks</p>