问题描述
在 Confluence 编辑器中保存页面会引发以下错误:
Unable to communicate with server. Saving is not possible at the moment.
CODE
Unsupported character
We can’t save because the character isn’t supported by your database.
Remove this character or use a Confluence symbol or emoticon instead.
CODE
confluence 日志有以下错误
2019-08-15 17:09:21,451 ERROR [http-nio-8090-exec-4622] [common.error.jersey.ThrowableExceptionMapper] toResponse Uncaught exception thrown by REST service: Hibernate operation: could not execute statement; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1366]; Incorrect string value: '\xF0\x9F\x99\x8F</...' for column 'BODY' at row 1; nested exception is java.sql.SQLException: Incorrect string value: '\xF0\x9F\x99\x8F</...' for column 'BODY' at row 1
-- referer: https://confluence.mycompany.com/pages/resumedraft.action?draftId=27691324&draftShareId=15edb6ff-92ab-4e11-b404-7ee318e9deaa | url: /rest/tinymce/1/drafts | traceId: 49d8e79835835a7b | userName: myusername
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute statement; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1366]; Incorrect string value: '\xF0\x9F\x99\x8F</...' for column 'BODY' at row 1; nested exception is java.sql.SQLException: Incorrect string value: '\xF0\x9F\x99\x8F</...' for column 'BODY' at row 1
CODE
问题分析
可能是mysql的字符编码没有使用utf8mb4引起的, emoji(表情符号)这种字符需要utf8mb4 (4 bits 的utf8)的支持
解决方案
临时方案
移除页面中的emoji特殊字符
根本解决
- 升级到Confluence 7.3以后的版本,支持 mysql 5.7 和 8.0 de utf8mb4编码
- 更新数据库编码
confluence 更改utf8mb4请参见 Confluence mysql 字符集修改为utf8mb4, collation修改为utf8mb4_bin