0

I am able to save into my database field correctly but if I apply html_entity_decode() function to the string, I get: PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x93\xB8 b...' for column 'description' at row 1... How can I solve this? I am using html_entity_decode to convert ' ', '—', '’' and whatnot to actual character.

I am using MySQL with utf8mb4 encoding.

How can I solve this?

Adam
  • 2,948
  • 10
  • 43
  • 74
  • if it only these values: ' ', '—', '’' - just simple `str_replace` it. OT what client encoding connection you set?, see: https://stackoverflow.com/a/32185693/1194525 – bato3 Feb 09 '18 at 01:21
  • Possible duplicate of [when initializing PDO - should I do: charset=UTF8 or charset=UTF8MB4?](https://stackoverflow.com/questions/31660005/when-initializing-pdo-should-i-do-charset-utf8-or-charset-utf8mb4) – bato3 Feb 09 '18 at 01:21

0 Answers0