"✔️" is a 3-byte Emoji; "" takes 4 bytes. So the problem is that CHARACTER SET utf8
needs to be changed to CHARACTER SET utf8mb4
.
The solution is to either
- Provide
utf8mb4
in the connection parameters`. This action varies with the client (Java/PHP/...).
- Add
SET NAMES utf8mb4
to the code right after connecting.
If these are not specific enough, search for where you have utf8
and it could be utf8mb4
. (Note: I am not saying UTF-8
, which is the non-MySQL equivalent of utf8mb4
.)
More discussion: Trouble with UTF-8 characters; what I see is not what I stored
Technically the checkmark takes 6 bytes -- two 3-byte characters: hex E29C94 EFB88F. So it worked fine with utf8
. However the dollar sign needs 4 bytes: F09F92B2, so it could not be represented in utf8, only in utf8mb4. The failure was shown via 4 question marks.