title: php hex: how to convert from xml
body: <p>Good day). A hex question.</p>
  
  <p>This is a piece of imported xml data:</p>
  
  <pre><code>&lt;?xml version=\x221.0\x22 encoding=\x22UTF-8\x22?&gt;
  \x0A&lt;issues&gt;\x0A\x09&lt;issue id=\x225863\x22 found=\x221\x22&gt;\xD0\x9F\xD0\xBE \xD0\xBD\xD0\xBE\xD0\xBC\xD0\xB5\xD1\x80\xD1\x83 \xD1\x81\xD1\x87\xD0\xB
  5\xD1\x82\xD0\xB0 19479 \xD0\xBD\xD0\xB0\xD0\xB9\xD0\xB4\xD0\xB5\xD0\xBD\xD0\xBE:\x0A\xD0\x97\xD0\xB0\xD0\xBA\xD0\xB0\xD0\xB7 \xD0\xBF\xD0\xBE\xD0\xBA\xD1\x83\xD0\xBF\xD0\xB0\xD1\x82\xD0\xB5\xD0\xBB\xD1\x8F
  0000015597 \xD0\xBE\xD1
  </code></pre>
  
  <p>Seems to be hex, but i can't find matching parser from standart libraries.</p>
  
  <p>Is there any ?</p>
  
  <p>I tried <strong>preg_replace_callback</strong>:</p>
  
  <pre><code>$source = preg_replace_callback('/\\\\x([a-f0-9]+)/mi', 
    function($m)
    {
      return chr('0x'.$m[1]);
    }, $source);
  </code></pre>
  
  <p>Output is still little dirty:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;issues&gt;
      &lt;issue id="5863" found="1"&gt;По номеру сч�\xB
  5та найдено:
  Ответственный:Максим\xD
  0�йко Евгений
  частное лицо (Саф\x
  D1�онов Антон )
  </code></pre>
  
  <p>So is there a solution to correctly parse it ?</p>