MySQL can't save 4 bytes of problems (i.e. emoticons)

Source: Internet
Author: User

This question 62044887

There is a detailed solution. Here, I'm just documenting the problems I'm having.

This problem is usually encountered when inserting the database into the Address book (the name has everything)

The first of these methods

Database Design table when we generally set varchar is generally UTF8 utf8_general_ci if this state occurs then change to UTF8MB4 utf8m64_general_ci

Of course, this isn't going to work. I've had this problem for the first time, and it's not working. Second method of second modification perfect solution this should be related to the configuration of the database

The second method of

If we touch this 4-byte (usually emoticons) then we can identify it in Java and replace it with a * * or "" This is the copy of the pro-test available


public static string Filteremoji (String source,string slipstr) {
if (Stringutils.isnotblank (source)) {
return Source.replaceall ("[\\ud800\\udc00-\\udbff\\udfff\\ud800-\\udfff]", SLIPSTR);
}else{
return source;
}
}

MySQL can't save 4 bytes of problems (i.e. emoticons)

Related Article

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.