title: Double UTF-8 encoding, but why? PHP/MySQL
body: <p>I have some forms, that insert some data into a MySQL database, and for some reason the characters get double utf-8 encoded. You don't see it on the front-end of my website, but in the back-end you do, if i look at the data from phpmyadmin, it's double encoded.</p>
  
  <p>Also, to display data entered from phpmyadmin i have to <code>utf8_encode</code> it.</p>
  
  <p>If i use <code>uft8_decode()</code> on my data before i put it into my database, it works, but then i'd have to use <code>utf8_encode()</code> again to display my data properly, and i would like to find a better solution that re-writing most of my code.</p>
  
  <p>The characters i'm dealing with is the danish æ, ø and å characters.</p>
  
  <p>I have every setting i can find in php.ini set to utf-8, every thing i can find in phpmyadmin to utf8, html meta tag set to utf-8, and still i have this error to deal with.</p>
  
  <p>So my question is, does anyone know why this happens, or how i could fix it?..</p>
  
  <p><strong>Update:</strong> After running the mysql code Jako suggested, the data is properly encoded in the back-end of the database when it comes from the front-end, but i still need to run <code>utf8_encode()</code> to display the data properly on the front-end, any ideas?..</p>
  
  <p><strong>Update 2:</strong> Again, after running the code from the answer to <a href="https://stackoverflow.com/questions/1650591/whether-to-use-set-names">this question</a> i still had problems, the encoding was now on and off utf8, and i suspect phpmyadmin for resetting the encoding somehow. I found a new way of doing things, and it works flawlessly, described in my answer below...</p>