Emoji Support in Forms

Hi,

I’m using Camunda with the Spring Boot Integration and MySQL as a datastore. (but I guess the problem is engine related)

When saving a simple form that allows text input, which contains Emojis, like “:man_shrugging:t2:” [Unicode: U+1F937 U+200D U+2642 U+FE0F), the engine starts throwing errors due to improper SQL usage. (error message from log attached)

Apparently because it’s encoded to UTF-8 bytes which results in the following string representation using the emoji above as example (you’ll find the first part of this representation in the attached error logs):
F0 9F A4 B7 F0 9F 8F BB E2 80 8D E2 99 82 EF B8 8F

Best regards

camunda-emoji-sqlerr.txt (42.0 KB)

@dorianweidler To store 4-byte Unicode characters in MySQL you need

  • a modern version of the database engine, version 5.5 or later,
  • set the column collation to COLLATE utf8mb4_unicode_ci in the database,
  • configure MySQL to use utf8mb4 in the character columns.
var1 varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL

(or)

alter table <some_table> convert to character set utf8mb4 collate utf8mb4_unicode_ci

(or)

set parameters on command line when starting the server: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci

Refer the below links:
http://pinter.org/archives/5884

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

1 Like