title: PHP DOMDocument failing to handle utf-8 characters (☆)
body: <p>The webserver is serving responses with utf-8 encoding, all files are saved with utf-8 encoding, and everything I know of setting has been set to utf-8 encoding.</p>
  <p>Here's a quick program, to test if the output works:</p>
  <pre><code>&lt;?php
  $html = &lt;&lt;&lt;HTML
  &lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot;&gt;
      &lt;title&gt;Test!&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;☆ Hello ☆ World ☆&lt;/h1&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  HTML;
  
  $dom = new DOMDocument(&quot;1.0&quot;, &quot;utf-8&quot;);
  $dom-&gt;loadHTML($html);
  
  header(&quot;Content-Type: text/html; charset=utf-8&quot;);
  echo($dom-&gt;saveHTML());
  </code></pre>
  <p>The output of the program is:</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;&lt;head&gt;&lt;meta charset=&quot;utf-8&quot;&gt;&lt;title&gt;Test!&lt;/title&gt;&lt;/head&gt;&lt;body&gt;
      &lt;h1&gt;&amp;acirc;&amp;#152;&amp;#134; Hello &amp;acirc;&amp;#152;&amp;#134; World &amp;acirc;&amp;#152;&amp;#134;&lt;/h1&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  <p>Which renders as:</p>
  <h1>â˜† Hello â˜† World â˜†</h1>
  <hr />
  <p>What could I be doing wrong? How much more specific do I have to be to tell the DOMDocument to handle utf-8 properly?</p>