What type of storage should I use when storing WeChat user names?

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.