Saving Emoji characters to Appian Cloud MySQL database

Hi,

We just encountered an error where a user entered an emoji into a form's text description, which then failed to save in the MySQL database. Apparently this is due to the collation that is set on the database (utf8_general_ci) does not support such characters.

(FYI, the character was & # 55357; & # 56842; - aka smiling face with smiling eyes: http://apps.timwhitlock.info/unicode/inspect/hex/1F60A)

What is the recommended way to handle such data?

Thanks,

Mike

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    hi  you can follow the following steps to allow MySQL Database Table to store emoji : 


    1) Set the database charset to utf8mb4

    2) Set the charset of column to utf8mb4

    Below are the commands which you would like to execute
    ===============================================================================================================
    ALTER TABLE Tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin

    ALTER TABLE `comments` CHANGE `text` `text` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;

     

    Hope this will help You 

Reply
  • 0
    Certified Lead Developer

    hi  you can follow the following steps to allow MySQL Database Table to store emoji : 


    1) Set the database charset to utf8mb4

    2) Set the charset of column to utf8mb4

    Below are the commands which you would like to execute
    ===============================================================================================================
    ALTER TABLE Tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin

    ALTER TABLE `comments` CHANGE `text` `text` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;

     

    Hope this will help You 

Children
No Data