Issue
- Emojis are being sanitized when AntiSamy is enabled.
- A warning is thrown in the logs where the character codes are matching the previously written emoji:
Could not execute JDBC batch update
- The emoji is switched to a Chinese character after submission.
Environment
- DXP 7.0
- DXP 7.1 below Fix Pack 28
- DXP 7.2 below Fix Pack 19
- DXP 7.3 below Update 5
Resolution
- This is a known issue fixed by LPS-136907, which has already been released in official fix packs/updates on DXP 7.1-DXP 7.3
- Updating to the appropriate fix pack/update will resolve the issue in most of the databases automatically, except MariaDB, where you will need to set additional configurations:
-
Configure the my.ini (on Windows: C:\Program Files\MariaDB 10.2\data\my.ini) configuration file with the following lines (if you have additional lines in the configuration, please push these lines after the additional ones):
[mysqld]
character-set-client-handshake = FALSE
skip-character-set-client-handshake
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
init-connect='set names utf8mb4'
init-connect='set collation_connection = utf8mb4_unicode_ci'
init-connect='set character_set_client = utf8mb4'
collation_server = utf8mb4_unicode_ci
character_set_server = utf8mb4 -
Run the following query in your database:
USE liferay;
ALTER DATABASE liferay CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
ALTER TABLE mbmessage CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -
Additional query to run:
USE liferay;
SET NAMES UTF8MB4; -
Run the following query to check if you have the same configuration as below:
SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
character_set_client utf8mb4 character_set_connection utf8mb4 character_set_database utf8mb4 character_set_filesystem binary character_set_results utf8mb4 character_set_server utf8mb4 character_set_system utf8 collation_connection utf8mb4_general_ci collation_database utf8mb4_unicode_ci collation_server utf8mb4_unicode_ci - Launch the portal.
- Expected and actual result: The Emoji appears on the UI and no error is shown in the log related to the Emoji.