Ameya Patkar
Ameya Patkar

Reputation: 91

fetching utf8mb4 data(emojies ) with java from MySQL

enter image description here

while getting emojies stored in table column of type varchar(2000) with character set utf8mb4 and collation utf8mb4_unicode_ci of MySQL database having version innodb_version 5.6.26-74.0 it get displayed as ? in apple's ios ipad application.

I have change character set and collation of all table where I storing my emojies (smileys) with below mysql sql ..

enter image description here

ALTER TABLE studentresponse
CONVERT TO CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;


ALTER TABLE observation
CONVERT TO CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;

By searching solution over the internet I got something like this.. You have to set connection encoding to utf8mb4 , otherwise MySQL will convert the stored utf8mb4 data to utf8,

so please help me out in this...

ALTER TABLE studentwadata
CONVERT TO CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;

but on apples ipad application it shows as ? for all smileys that have enter from ipad and stored into mysql table as ? only.

Upvotes: 1

Views: 2041

Answers (1)

Rick James
Rick James

Reputation: 142540

It is not sufficient to change the table.

When establishing the connection between client and server, you need to say that the chatter will be in utf8mb4. You first .jpg show that it is currently set to only utf8.

Are you using spring?

You can execute SET NAMES utf8mb4 after connecting to change those settings.

Upvotes: 2

Related Questions