Easy Forms and MySQL utf8 vs utf8mb4

If your users enter emojis into your Easy Forms then they will experience an error when they submit it and you will see errors like this in your Confluence server logs:

1 2 3 Caused by: java.sql.SQLException: Incorrect string value: '\xF0\x9F\x99\x82' for column 'VALUE' at row 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3976)

Root cause is that your MySQL database is configured to use utf8 (and doesn’t support 4-byte characters). Your database administrator should consider changing your database to utf8mb4 to support 4-byte characters.

'\xF0\x9F\x99\x82' is 4-bytes that denote a smiley face emoji/emoticon. To see that:

I think the problem character is a small smiley face emoticon:

If you do some google searches for this problem you will find several posts like this:

This is a common problem/limitation with MySQL.

See this article from Atlassian about working with MySQL in case you switch your DB from utf8 to utf8mb4: https://confluence.atlassian.com/kb/how-to-fix-the-collation-and-character-set-of-a-mysql-database-744326173.html

It can be tricky to enter an emoji into an Easy Form when you are experimenting with this problem. Here is how you can do it:

  • Go to https://www.browserling.com/tools/utf8-decode

  • Paste this in there:

  • that is the 4 byte character for a small smiley face emoticon

  • click "UTF8 Decode"

  • See a small smiley face emoticon.

  • you can copy that to get it into your buffer for pasting into forms

  • paste into a text field or paragraph field in your form

  • that will break when you submit the form if your Database is MySQL utf8 and not utf8mb4. It will work fine for most other databases.