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
hi mikej117 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