MySQL deposit emoji expression now for?

Source: Internet
Author: User
MySQL deposit emoji expression now for???. According to the online version of the MySQL character set to UTF8MB4, or invalid, displayed as garbled. Has anyone ever met you?


Reply to discussion (solution)

Emoji expression is an extended utf-16 encoding
You can post base64 encoded strings that contain emoji expressions.
And see if I can help you out.

Emoji expression is an extended utf-16 encoding
You can post base64 encoded strings that contain emoji expressions.
And see if I can help you out.


This is the expression base64 the data after the save. 8j+yhpcfmim=. Version * bother to look!. Now many applications support this expression input, just do not know how to save.

It should be said that instead of using the UTF8MB4 character set, I don't know why you can't.
Given that there are not many emoji characters in the text, you can replace them with a regular

$text = Base64_decode (' 8j+yhpcfmim= '); Echo $text = Preg_replace_callback ('/[\xf0-\xf7].{ 3}/', function ($r) {return ' @E '. Base64_encode ($r [0]);}, $text);
@E8J +yha== @E8J +ygw==

It's going to be a reverse conversion.
$s = Preg_replace_callback ('/@e (. { 6}==)/', function ($r) {return Base64_decode ($r [1]), ' @E8J +yha== @E8J +ygw== '); Var_dump (Base64_decode (' 8j+yhpcfmim= ') = = $s);
BOOL (TRUE)

It should be said that instead of using the UTF8MB4 character set, I don't know why you can't.
Given that there are not many emoji characters in the text, you can replace them with a regular

$text = Base64_decode (' 8j+yhpcfmim= '); Echo $text = Preg_replace_callback ('/[\xf0-\xf7].{ 3}/', function ($r) {return ' @E '. Base64_encode ($r [0]);}, $text);
@E8J +yha== @E8J +ygw==

It's going to be a reverse conversion.
$s = Preg_replace_callback ('/@e (. { 6}==)/', function ($r) {return Base64_decode ($r [1]), ' @E8J +yha== @E8J +ygw== '); Var_dump (Base64_decode (' 8j+yhpcfmim= ') = = $s);
BOOL (TRUE)


Yes, it's depressing. Online all say as long as set as UTF8MB4 on line, but mine is not. The MySQL version is 5.6 .... , Wampserver environment. Is it an environmental problem?

Landlord, I also encountered the same problem, how did you finally solve?

  • 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.