title: How to read a InputStream with UTF-8?
body: <p>Welcome all</p>
  
  <p>I'm developing a Java app, that calls a PHP from internet that it's giving me a XML response.</p>
  
  <p>In the response is contained this word: "Próximo", but when i parse the nodes of the XML and obtain the response into a String variable, I'm receiving the word like this: "Pr&amp; oacute;ximo".</p>
  
  <p>I'm sure that the problem is that i'm using different encoding in the Java app then encoding of PHP script. Then, i supose i must set encoding to the same as in your PHP xml, UTF-8</p>
  
  <p>This is the code i'm using to geat the XML file from the PHP.</p>
  
  <p><strong>¿What should i change in this code to set the encoding to UTF-8? <em>(note that im not using bufered reader, i'm using input stream)</em></strong></p>
  
  <pre><code>        InputStream in = null;
          String url = "http://www.myurl.com"
          try {                              
              URL formattedUrl = new URL(url); 
              URLConnection connection = formattedUrl.openConnection();   
              HttpURLConnection httpConnection = (HttpURLConnection) connection;
              httpConnection.setAllowUserInteraction(false);
              httpConnection.setInstanceFollowRedirects(true);
              httpConnection.setRequestMethod("GET");
              httpConnection.connect();               
              if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_OK)
                  in = httpConnection.getInputStream();   
  
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();                     
              DocumentBuilder db = dbf.newDocumentBuilder();
              Document doc = db.parse(in);
              doc.getDocumentElement().normalize();             
              NodeList myNodes = doc.getElementsByTagName("myNode"); 
  </code></pre>