Legacy Knowledge Base
Published Jun. 30, 2025

Emojis are sanitized into Chinese characters

Written By

Solyom Nagy-Györkös

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

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:
  1. 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
  2. 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;
  3. Additional query to run:

    USE liferay;
    SET NAMES UTF8MB4;
  4. 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
  5. Launch the portal.
  6. Expected and actual result: The Emoji appears on the UI and no error is shown in the log related to the Emoji.
Did this article resolve your issue ?

Legacy Knowledge Base