Issue
- When inserting emojis (emoticons) to a Web Content article, the portal fails to add/update the article and an error similar to the one below is shown on logs.
09:33:30.544 ERROR [http-nio2-8080-exec-48][JDBCExceptionReporter:234] Incorrect string value: '\xF0\x9F\x98\x8D\xE2\x9D...' for column 'content' at row 1
Resolution
- While Liferay DXP supports emoji, changes must be made to both the database and to the
portal-ext.properties DB connection string. This article deals the procedure with MySQL only, but similar solutions are available to other RDBMS.
- Create the database with the character set
utf8mb4 instead of utf8 (which is an alias for utf8mb3). Example:
CREATE DATABASE `lportal` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;