java - 设置数据库 uft8mb4 后黑色菱形和问号持续存在
问题描述
解决方案
characterEncoding=utf-8 is incompatible with utf8mb4. Use character_set_server=utf8mb4
in your JDBC URL instead, or config.addDataSourceProperty("character_set_server", "utf8mb4");
. Do not use characterEncoding at all.
From the MySQL Connection/J developer guide → Using Character Sets → Setting the Character Encoding:
… to use the 4-byte UTF-8 character set with Connector/J, configure the MySQL server with
character_set_server=utf8mb4
, and leavecharacterEncoding
out of the Connector/J connection string.
And right below that:
Warning
In order to use the
utf8mb4
character set for the connection, the server MUST be configured withcharacter_set_server=utf8mb4
; if that is not the case, whenUTF-8
is used forcharacterEncoding
in the connection string, it will map to the MySQL character set nameutf8
, which is an alias forutf8mb3
.
推荐阅读
- r - R 闪亮:runApp() 可以在浏览器中的“http://localhost:port/”而不是“http://127.0.0.1:port/”打开闪亮的应用程序吗?
- python - 如何使用带有 Python 的 Selenium Webdriver 通过它们的 ID 获取元素的标签?
- r - 在第一个结束字符实例之后执行 gsub,而不是继续到字符串结尾
- xamarin - 相对于外部绑定上下文,如何在 ListView 中设置绑定上下文?
- lambda - 过滤器函数pyspark中“or-ing”时的括号
- macos - 无法在 Mac 上测试 Mosquitto 服务器
- linux - 如何将 2 个文件中的字符串组合成 1 个并用空格分隔?
- c - &符号在scanf的PlaceHolder?
- git - web3 + git 冲突
- r - 如何在 R 中逐行列出大型数据框?