I can't store emoji characters in mysql datatbase.
I searched a lot, but again fails. I have followed this tutorial and changed these variables from Variables tab in phpmyadmin.
| Variable_name | Value
----------------------------
character_set_client | utf8
character_set_connection | utf8mb4
character_set_database | utf8mb4
character_set_filesystem | binary
character_set_results | utf8
character_set_server | utf8mb4
character_set_system | utf8
collation_connection | utf8mb4_unicode_ci
collation_database | utf8mb4_unicode_ci
collation_server | utf8mb4_unicode_ci
NOTE: set_client and set_result are also utf8mb4
in Variables tab in phpmyadmin.
I even added these lines in my.ini file:
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
But again no result!! I just get ????
instead of emoji. Any idea?
Edit: SHOW CREATE TABLE emoji
result
CREATE TABLE `emoji` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`emj_text` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `emj_text` (`emj_text`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
Best Answer
Paraphrasing https://stackoverflow.com/a/38363567/1766831 :
Question Marks (regular ones, not black diamonds) (Se?or for SeƱor):
utf8mb4
.Once
????
is stored, the Emoji is lost. That is, theINSERT
side has the problem. TheSELECT
side may also have a problem.