A customer of ours signed up for an event in a webform. She added a smiley from her iPhonbe and it caused the website to "crash".

The watchdog recorded this:

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x98\x8A' for column 'data' at row 1: INSERT INTO {webform_submitted_data} (nid, sid, cid, no, data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => 223 [:db_insert_placeholder_1] => 442 [:db_insert_placeholder_2] => 3 [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => Allergisk mot krabba! ) i drupal_write_record() (rad 7333 av /home/test/public_html/includes/common.inc).

// Adam

Comments

AdamEvertsson created an issue. See original summary.

AdamEvertsson’s picture

Issue summary: View changes
AdamEvertsson’s picture

Hmmm, posting the error message from watchdog made drupal.org throw a similar error. Perhaps this is deeper rooted in Drupal and not only in the glorious webform module...?

// Adam

Liam Morland’s picture

Status: Active » Closed (outdated)

This looks to me like a problem with the database not accepting UTF-8 characters. Changing the collation might fix it. Or it could be a Drupal core issue.

7.x-3.x only receives security updates. If this issue exists in 7.x-4.x, please re-open and move the issue to that version.

vegi’s picture

Version: 7.x-3.23 » 7.x-4.14
Priority: Normal » Major
Status: Closed (outdated) » Active

The error is still a problem: Inserting a smiley in a webform (i.e. with iPhone) makes the webform to crash:
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x98\x8A' for column 'data'...

I use the current version of Drupal 7.53 with webform 7.x-4.14.

Liam Morland’s picture

Title: iPhone smiley makes Webform crash » Emoticon causes "Incorrect string value" PDOException
Project: Webform » Drupal core
Version: 7.x-4.14 » 7.x-dev
Component: Code » database system
Priority: Major » Normal

This problem is in Drupal core, so it is not a Webform issue.

Steps to reproduce: Create a new piece of content and set its title to an emoticon, such as the one mentioned here:

http://apps.timwhitlock.info/unicode/inspect?s=%F0%9F%98%89

Enabling multi-byte UTF-8 support would probably fix it for your site. However when this is not enabled, Drupal should not crash.

I tried to put an example emoticon into this comment, but it caused the error on drupal.org.

amit0212’s picture

That your site is made with Drupal is fairly apparent to all. For production, you should set your error reporting so that users don't see error messages.

This issue is not specific to webform -- it applies to all of Drupal. We're not tackling what is in effect a core issue. The solution is to update your database server and set your character sets appropriately. It is not clear to me that the utf-8 in the connection is an issue. I think you can still set the character set in the tables.

https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html

lokapujya’s picture

😉

osopolar’s picture

I have the same problem, any news on this?

SHOW TABLE STATUS FROM ; shows Collation: utf8_general_ci for all tables.

longwave’s picture

Category: Bug report » Support request
Status: Active » Fixed

@ospolar Please follow the steps to enable multibyte UTF-8 support in your database at https://www.drupal.org/node/2754539

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

sushilpal’s picture

.