1

I have a small site with a few forms.

The type of the document is UTF-8:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

When I write an en dash (–) it gets converted to – and when hitting submit on a form with an en dash somewhere in the fields it causes the page to fail updating.

This is driving me crazy. Why is this happening?

Cris
  • 4,004
  • 16
  • 50
  • 74
  • Possible duplicate of [UTF-8 all the way through](http://stackoverflow.com/questions/279170/utf-8-all-the-way-through). You're forgetting to use UTF-8 somewhere in the process: there's a comprehensive checklist in the linked question. – Álvaro González Apr 11 '14 at 11:51

1 Answers1

1

Everything must be explicitly set to UTF-8: The database fields, the HTML document, and (most critically) the connection between PHP and MySQL.

The exact way to do this depends on what library you are using. For instance, with the old mysql library, it's mysql_set_charset

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592