title: htmlspecialchars is dropping characters
body: <p>I'm trying to use <code>htmlspecialchars</code> but it doesn't seem to be working. I'm using OSX 10.9.1 and PHP 5.4.17. I write:</p>
  
  <pre><code>var_dump(htmlspecialchars("&lt;a href='test'&gt;Test&lt;/a&gt;", ENT_QUOTES, 'UTF-8'));
  echo htmlspecialchars("&lt;a href='test'&gt;Test&lt;/a&gt;", ENT_XHTML, 'UTF-8');
  </code></pre>
  
  <p>and get:</p>
  
  <pre><code>string '&amp;lt;a href=&amp;#039;test&amp;#039;&amp;gt;Test&amp;lt;/a&amp;gt;' (length=45)
  &lt;a href='test'&gt;Test&lt;/a
  </code></pre>
  
  <p>Any ideas?</p>