mysql数据库保存emoji表情
参考(查看设置字符集):https://www.jianshu.com/p/a18269a4870e
步骤(jfinal默认的数据库连接配置不用修改):
1.修改字段的字符集(uf8mb4),推荐校对规则uf8mb4_bin:
ALTER TABLE tbl_name CHANGE c_name c_name CHARACTER SET character_name [COLLATE ...];
2.升级mysql-connector-java版本至5.1.47以上。在低于5.1.47版本时,jdbcUrl中设置的characterEncoding=utf-8对应mysql服务端的utf8,而从5.1.47开始,则对应到utf8mb4。如下:
set character_set_database=utf8mb4;
set character_set_results=utf8mb4;
set character_set_server=utf8mb4;
set collation_connection=utf8mb4_unicode_ci;
set collation_database=utf8mb4_unicode_ci;
set collation_server=utf8mb4_unicode_ci;
SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';