My current user name is stored in varchar (64) in mysql, but I found that some names cannot be inserted into the database, because some have various expressions. SQLSTATE [HY000]: Generalerror: 1366 Incorrectstringvalue: & #039; xF0x9Fx94x9E... my current user name is stored in varchar (64) in mysql, but I found that some names cannot be inserted into the database, because some have various expressions.
SQLSTATE [HY000]: General error: 1366 Incorrect string value: '\ xF0 \ x9F \ x94 \ x9E \ xE6 \ x88...' for column 'nickname' at row 1
Reply content:
My current user name is stored in varchar (64) in mysql, but I found that some names cannot be inserted into the database, because some have various expressions.
SQLSTATE [HY000]: General error: 1366 Incorrect string value: '\ xF0 \ x9F \ x94 \ x9E \ xE6 \ x88...' for column 'nickname' at row 1
Emoji? Utf8mb4
No problem with varchar storage.
Escape or transcoding can be considered for insertion.
You can consider base64 encoding username before saving it to the database.
In fact, emoji are only some special symbols, which are no different from common characters, but the computer cannot display or display a box. There is a table with the correspondence between emoji and characters on the Internet. Please find it!