title: Alternative to mb_convert_encoding with HTML-ENTITIES charset
body: <p>I have the following code:</p>
  
  <pre><code>mb_convert_encoding($string, 'HTML-ENTITIES', 'utf-8');
  </code></pre>
  
  <p>I need to have an alternative code which does exactly the same but does not use any mb_* functions (the mb extension is not available on some environments).</p>
  
  <p>I thought that</p>
  
  <pre><code>utf8_decode(htmlentities($string, ENT_COMPAT, 'utf-8'));
  </code></pre>
  
  <p>should do exactly the same, but unfortunately it does not.</p>