Fixing those question marks (Wordpress)

Have you noticed that on some websites you get annoying question-marks come up in content where the odd ' comes up as ’. This is a slight annoyance but still viewable, however if you then code a website to this standard, and include the ’, you will notice (when you pull it out) a slight bug:

Image showing the question marks you sometimes get in SQL data.

So you're wondering, "How do I fix it?".

Very simple actually, just before you run your query to access the data, put this query first:

mysql_query("SET NAMES 'utf8'");

This will set the content to be UTF8, which should fix the problem you will have with the annoying question marks.

Hope this helps someone.