title: PHP htmlentities not working? output is?
body: <p>I am trying to store some data in my MySQL database.
  When I try to input special characters and even foreign characters like ø or звяф, I want them to be stored as html entities (like &#337;)</p>
  
  <p>I thought it's supersimple, just use htmlentities(), but when I store data, I am getting nothing but ???? in the database.</p>
  
  <p>Any ideas?</p>
  
  <p>Here is the code I use right now:</p>
  
  <pre><code>$sqlOrder="INSERT INTO data (
          bad, cname, lor
      )
      VALUES (
          '".htmlentities($b-&gt;getBad(), ENT_COMPAT, 'UTF-8')."', '".htmlentities($b-&gt;getCName(), ENT_COMPAT, 'UTF-8')."', '".htmlentities($b-&gt;getLor(), ENT_COMPAT, 'UTF-8')."'
      )";
  </code></pre>
  
  <p>As said, the result in the database is ????????? for any special characters such as кршуцкыя or æåø.</p>