0

I am doing a project in which I have to save tweets into my MySQL database. The problem is some tweets contains smilies and other symbols which I am not able to save - it shows error like below:

Incorrect string value: '\xF0\x9F\x98\x82. ...' for column 'text' at row 1

I was trying to convert to utf8mb4 using this link tutorial, and in step 5, I have changed my.ini file in my C:\ProgramData\MySQL\MySQL Server 5.6 directory. But when I do

SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%'; 

in my MySQL console, I am not getting the desired result, meaning my character set is not changed to utf8mb4 - it is still utf8.

Please guide me how to resolve this, as I am new to this. I have attached an image to the step 5 (Modify connection, client, and server character sets) of the above tutorial.enter image description here

  • your link to tutorial is not working,please check – Nawaz Sohail Sep 7 '15 at 15:15
0

You need utf8mb4 instead of utf8 to get 😂 and a number of other emoji.

You need SET NAMES utf8mb4 after connecting.

You also need to make sure SHOW CREATE TABLE says utf8mb4.

Your "this link tutorial" seems to be broken. I would like to see what is says. (And perhaps find an error in it.)

More discussion of utf8mb4.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.