Encoding issue with form and HTML Purifier / MySQL

Posted by Andrew Heath on Stack Overflow See other posts from Stack Overflow or by Andrew Heath
Published on 2010-04-28T12:46:48Z Indexed on 2010/04/28 13:33 UTC
Read the original article Hit count: 312

Filed under:
|
|
|
|

Driving me nuts...

Page with form is encoded as Unicode (UTF-8) via:

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

entry column in database is text utf8_unicode_ci

copying text from a Word document with " in it, like this: “1922.” is insta-fail and ends up in the database as â??1922.â?? (typing new data into the form, including " works fine... it's cut and pasting from Word...)

PHP steps behind the scenes are:

  • grab value from POST
  • run through HTML Purifier default settings
  • run through mysql_real_escape_string
  • insert query into dbase

Help?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql