title: PHP XML UTF-8 with special characters throws errors
body: <p>I am having some issues receiving UTF-8 XML files back from DHL API. As long as I don't send it's way any special characters like ś or ó, everything works just fine, but with these characters my app crashes when trying to load XML file received from DHL throwing me errors:</p>
  
  <pre><code>Warning:  DOMDocument::loadXML() [domdocument.loadxml]: 
  Opening and ending tag mismatch: AddressLine line 43 and Consignee 
  in Entity, line: 53 in D:\xampp\htdocs\ebay\catch2.php on line 29
  
  Warning:  DOMDocument::loadXML() [domdocument.loadxml]: 
  Opening and ending tag mismatch: Consignee line 40 and res:ShipmentValidateResponse 
  in Entity, line: 97 in D:\xampp\htdocs\ebay\catch2.php on line 29
  
  Warning:  DOMDocument::loadXML() [domdocument.loadxml]: Premature end of 
  data in tag ShipmentValidateResponse line 1 in Entity, line: 98
  in D:\xampp\htdocs\ebay\catch2.php on line 29
  </code></pre>
  
  <p>This is a XML I send</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  ... 
  &lt;AddressLine&gt;address&lt;/AddressLine&gt; 
  &lt;AddressLine&gt;asfśó&lt;/AddressLine&gt; 
  ...
  </code></pre>
  
  <p>What I receive:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  ...
  Lines 40 to 43:
  
  &lt;Consignee&gt;
  &lt;CompanyName&gt;Person&lt;/CompanyName&gt;
  &lt;AddressLine&gt;address&lt;/AddressLine&gt;
  &lt;AddressLine&gt;asf??ddressLine&gt;
  ...
  </code></pre>
  
  <p>Here is what happens around line 29:</p>
  
  <pre><code>$responseXml = $session-&gt;sendHttpRequest($requestXmlBody);
  if(stristr($responseXml, 'HTTP 404') || $responseXml == '')
      die('&lt;P&gt;Error sending request');
  $responseXml = utf8_decode($responseXml);
  $responseDoc = new DOMDocument('1.0', 'UTF-8');
  $responseDoc-&gt;loadXML($responseXml);
  </code></pre>
  
  <p>E:
  Removing utf8_decode doesn't help much. Just a new error:</p>
  
  <pre><code>Warning:  DOMDocument::loadXML() [domdocument.loadxml]: 
  Input is not proper UTF-8, indicate encoding !
  Bytes: 0xF3 0x3C 0x2F 0x41 in Entity, line: 43 in D:\xampp\htdocs\ebay\catch2.php on line 29
  </code></pre>
  
  <p>E2:
  hex dump</p>
  
  <pre><code>0000-0010:  3c 3f 78 6d-6c 20 76 65-72 73 69 6f-6e 3d 22 31  &lt;?xml.ve rsion="1
  0000-0020:  2e 30 22 20-65 6e 63 6f-64 69 6e 67-3d 22 55 54  .0".enco ding="UT
  0000-0030:  46 2d 38 22-3f 3e 3c 72-65 73 3a 53-68 69 70 6d  F-8"?&gt;&lt;r es:Shipm
  </code></pre>
  
  <p>line 43:</p>
  
  <pre><code>0000-0960:  4c 69 6e 65-3e 0a 20 20-20 20 20 20-20 20 3c 41  Line&gt;... ......&lt;A
  0000-0970:  64 64 72 65-73 73 4c 69-6e 65 3e 61-73 66 3f f3  ddressLi ne&gt;asf?.
  0000-0980:  3c 2f 41 64-64 72 65 73-73 4c 69 6e-65 3e 0a 20  &lt;/Addres sLine&gt;..
  </code></pre>