Home >Database >Mysql Tutorial >How to Resolve \'Incorrect String Value\' Errors When Storing Emojis in MySQL?
Incorrect String Value: Encoding Resolution for Emoji and Emoticon Storage
While attempting to store a tweet containing special UTF-8 characters into a MYSQL table, an error message - "Incorrect string value: 'xF0x9Fx8ExB6xF0x9F...'" - arises. This error occurs despite the table's 'tweet_text' field being encoded in utf8mb4, which should support multiple languages.
After investigating the cause, it was determined that necessary MYSQL configuration settings were not correctly configured. To resolve the issue:
Connect to the MYSQL client and execute the following commands:
Verify the changes: Run the following command to confirm the character set and collation have been updated:
After completing these steps, the error message should no longer persist, and the tweet, including its 'MULTIPLE MUSICAL NOTES' characters, will be successfully stored in the 'tweet_text' column.
The above is the detailed content of How to Resolve 'Incorrect String Value' Errors When Storing Emojis in MySQL?. For more information, please follow other related articles on the PHP Chinese website!