legacy-knowledge-base
公開されました Sep. 10, 2025

Webコンテンツに絵文字を追加すると、ログで"Incorrect string value"というエラーが発生する

written-by

Gustavo Vasconcelos

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

learn-legacy-article-disclaimer-text

問題

  • Webコンテンツの記事に絵文字を挿入すると、ポータルが記事の追加/更新に失敗し、以下のようなエラーがログに表示されます
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

環境

  • Liferay DXP 7.x

解決

  • Liferay DXPは絵文字をサポートしていますが、データベースとportal-ext.propertiesのDB接続文字列の両方に変更を加える必要があります。 この記事では、MySQLのみを使用した手順を扱いますが、他のRDBMSでも同様のソリューションを利用できます
  • utf8 ( utf8mb3の別名) の代わりに、文字セット utf8mb4 でデータベースを作成します 例:
CREATE DATABASE `lportal` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  • utf8 の代わりに文字セット utf8mb4 のテーブルを作成します。 例:
CREATE TABLE `tablename` (
(...)
PRIMARY KEY (`primaryKey`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;
  • データベースが既に存在する場合は mysqldump でデータベースをダンプし、それぞれの CREATE TABLE クエリごとにパラメータ DEFAULT CHARSET=utf8 を DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci; に置き換えます
  •  portal-ext.properties のjdbc.default.url をパラメータ characterEncoding=UTF-8 かから useUnicode=trueに変更します

追加情報

  • LPS-43195:  Exception occurred when input "emoji" as content on mobile device

 

did-this-article-resolve-your-issue

legacy-knowledge-base