html_entity_decode - character encoding issue
<p>I am having issues with character encoding. I have simplified it to this below script:</p>

<pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php

$string = 'Stan&amp;#146;s';

echo $string.'&lt;br&gt;&lt;br&gt;'; // Stan's

echo html_entity_decode($string).'&lt;br&gt;&lt;br&gt;'; // Stan's

echo html_entity_decode($string, ENT_QUOTES, 'UTF-8'); // Stans

?&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>I would like to make use of the last <code>echo</code>. However, it removes the <code>'</code>, why?</p>

<h2>Update</h2>

<p>I have tried all three options <code>ENT_COMPAT</code>, <code>ENT_QUOTES</code>, <code>ENT_NOQUOTES</code> and it removes the <code>'</code> in all cases.</p>
