数据库字符集utf8与utf8mb4

原文地址:https://medium.com/@adamhooper/in-mysql-never-use-utf8-use-utf8mb4-11761243e434

用MySQL的朋友们请不要使用"utf8",请使用"utf8mb4"

今天我试图把UTF-8编码的字符串插入使用“utf8”编码的MariaDB数据库中,Rails抛出一个古怪的异常:

Incorrect string value: ‘\xF0\x9F\x98\x83 <…’ for column ‘summary’ at row 1

一切都很UTF-8:UTF-8 client,UTF-8的服务器,UTF-8编码的数据库,使用UTF-8的字符集。“

猜你喜欢

转载自blog.csdn.net/Dxx_23/article/details/80940831