title: XML parsing : encoding utf-8 & UTF-8
body: <p>I am trying to parse the values from this <a href="http://devws.barcodo.com/LoyaltyGateway/GetSiteMenu?websiteID=1&amp;languageID=1&amp;userID=0&amp;channelID=3&amp;portalID=873" rel="nofollow">LINK</a>, whose xml encoding is like this </p>
  
  <p><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;</code></p>
  
  <p>when I tried to <code>get response</code> throws message in logcat as shown</p>
  
  <pre><code>11-19 17:25:13.350: W/System.err(3360): This is not valid URL
  11-19 17:25:13.350: W/System.err(3360): java.lang.NullPointerException
  </code></pre>
  
  <p>When I tried with some other <a href="http://api.androidhive.info/pizza/?format=xml" rel="nofollow">LINK</a> ,whose encoding is like this</p>
  
  <p><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</code> It works fine, I can parse the values.</p>
  
  <p><strong>is xml parsing failing due encoding not being UTF-8,it is utf-8 ??</strong></p>
  
  <p>How should I deal with this. I have done google and am new to XML parsing. This is my first parsing which I am trying to create. Please let me know the way.</p>
  
  <p><strong>updated with code :</strong></p>
  
  <pre><code>public String getXmlFromUrl(String url) {
  
      String xml = null;
  
      try {            
          // defaultHttpClient
          HttpClient httpClient = new DefaultHttpClient();
          HttpPost httpPost = new HttpPost(url);           
          HttpResponse httpResponse = httpClient.execute(httpPost);
          HttpEntity httpEntity = httpResponse.getEntity(); 
          xml = EntityUtils.toString(httpEntity);
          System.out.println("response -- " + xml);
  
      } catch (UnsupportedEncodingException e) {
          e.printStackTrace();
      } catch (ClientProtocolException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
      // return XML
      return xml;
  }
  </code></pre>