Hello,

When my users send a private message from their phone and they include an emoji, they receive this error: Failed to send a message to [username]. Contact your site administrator.

The site log shows this error:
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x98\x89' for column 'body' at row 1: INSERT INTO {pm_message} (subject, author, body, format, timestamp, has_tokens, reply_to_mid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => Hello how are you [:db_insert_placeholder_1] => 880 [:db_insert_placeholder_2] => Hi, hope to see you soon. (emoji was inserted here) [:db_insert_placeholder_3] => full_html [:db_insert_placeholder_4] => 1493422171 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 1564 ) in _privatemsg_send() (line 1920 of /home/mysite/public_html/sites/all/modules/privatemsg/privatemsg.module).

How can I strip or convert all emoji content from the privatemsg body? I have tried the strip_utf8mb4 and emoji_scrub modules, but neither of those had any effect.

Thanks!

Comments

hockey2112 created an issue. See original summary.

ptmkenny’s picture

Category: Bug report » Support request
Status: Active » Closed (won't fix)

This is a Drupal core bug (not supporting utf8-mb4) and was fixed in Drupal 7.50.

It's not a particularly easy fix for existing sites, but it's possible.

Details are here:
https://www.drupal.org/project/drupal/issues/2488180