mysql:Incorrect string value: ‘\xF0\x9F\x98\xB8’ for column
原因是ios平台的emoji不受mysql当前字符集支持。
@seehttp://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html
10.1.10.6 The utf8mb4 Character Set (4-Byte UTF-8 Unicode Encoding)
The character set named utf8 uses a maximum of three bytes per character and contains only BMP characters.
As of MySQL 5.5.3, the utf8mb4 character set uses a maximum of four bytes per character supports supplemental characters:
For a BMP character, utf8 and utf8mb4 have identical storage characteristics: same code values, same encoding, same length.
For a supplementary character, utf8 cannot store the character at all, while utf8mb4 requires four bytes to store it. You need not worry about converting characters or losing data when upgrading utf8 data from older versions of MySQL.
基本多文种平面(Basic Multilingual Plane, BMP),或称第0平面或0号平面(Plane 0),是Unicode中的一个编码区段。编码从U+0000至U+FFFF。
MySQL不支持的Emoji问题
本文探讨了iOS平台上特定Emoji字符在MySQL中显示为'Incorrect string value'的原因。该问题源于MySQL utf8字符集不支持四字节的补充字符,如部分Emoji。文章解释了utf8与utf8mb4字符集之间的区别,并建议使用utf8mb4以确保所有Unicode字符的兼容性。
2372

被折叠的 条评论
为什么被折叠?



