title: Conversion of special characters in PHP
body: <p>I've tried many functions already, but I simply can't figure this out. The right way, anyway.</p>
  
  <p>In a form field called description, I can expect all kinds of characters. These need to be formatted into HTML entities before they're submitted to the db.</p>
  
  <p>Now, my code:</p>
  
  <pre><code>$formdesc = htmlentities($_POST['formdesc'], ENT_QUOTES);
  </code></pre>
  
  <p>For a MySQL query, I simply add a "safe" function to slash the ' off the string:</p>
  
  <pre><code>mysql_real_escape_string($formdesc);
  </code></pre>
  
  <p>However, this sometimes doesn't work. "é," for instance, becomes &Atilde;&copy; instead of &eacute;.</p>
  
  <p>There must be a normal function for this. Does anyone know what I mean?</p>