Emoji Write Database error: "Incorrect string value: ' \xf0\x9f\x91\x8d 2 ... ' for column ' Mark ' at row 1" solution

Source: Internet
Author: User

Stumbled across this problem and recorded that issues related to coding and database character sets have been cumbersome.

?? This emoji character reported an error in the repository: incorrect string value: ' \xf0\x9f\x91\x8d 2 ... ' for column ' Mark ' at row 1

The solution is as follows:

utf-8 encoding can be two, three, four bytes, emoji emoticons or some special characters are 4 bytes, and MySQL UTF8 encoding up to 3 bytes, so data is not plugged in. My solution is this 1. Locate the My.ini in the MySQL installation directory and make the following changes: [Mysqld]character-set-server=  Utf8mb4[mysql]default-character-Set=utf8mb4 modified after restarting MySQL2  set utf8mb4 collate utf8mb4_bin; (Replace table_name with your table name)

The development environment uses NAVICAT, so it is possible to modify the character set to UTF8MB4 directly.

Reference: http://blog.csdn.net/likendsl/article/details/7530979

Emoji Write Database error: "Incorrect string value: ' \xf0\x9f\x91\x8d 2 ... ' for column ' Mark ' at row 1" solution

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.