title: UTF-8 problem when saving to mysql
body: <p>My website is using charset iso 8859 1</p>
  
  <pre><code>&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
  </code></pre>
  
  <p>when user post chinese character, it will be saved into the database as &amp; # 2 0 3 2 0 ; &amp; # 2 2 9 0 9 ; which will output as the chinese character when retrieved.</p>
  
  <p>I need to set my website to UTF-8</p>
  
  <p>when user post chinese character, it will be saved as some funky character in the mysql, and when retrieved, some characters are correct but some are wrong.</p>
  
  <p>my question is, after i set to UTF-8, how to i make mysql save the text as  # 2 0 3 2 0 ; &amp; # 2 2 9 0 9 ; instead of funky chars.</p>
  
  <p>i tried to use htmlentities. it's not working correctly. </p>
  
  <p>my script is using </p>
  
  <pre><code>$message = htmlentities(strip_tags(mysql_real_escape_string($_POST['message']),'&lt;img&gt;&lt;vid&gt;')); 
  </code></pre>
  
  <p>when it's saved to mysql it is like this &auml;&frac12;&nbsp;&aring;&yen;&frac12; 
  when it's retrieved to be display is like this ä½ å¥½ &lt;---- is the funky character that is stored in mysql previously</p>