Why do quotes turn into funny characters when submitted in an HTML form?

Viewed 33037

I have an HTML form, and some users are copy/pasting text from MS Word. When there are single quotes or double quotes, they get translated into funny characters like:

'€™ and ’

The database column is collation utf8_general_ci.

How do I get the appropriate characters to show up?

Edit: Problem solved. Here's how I fixed it:

Ran mysql_query("SET NAMES 'utf8'"); before adding/retreiving from the database. (thanks to Donal's comment below).

And somewhat odd, the php function urlencode($text) was applied when displaying, so that had to be removed.

I also made sure that the headers for the page and the ajax request/response were all utf8.

3 Answers
Related