Answer the question
In order to leave comments, you need to log in
Full utf8mb4 support in Qt for storing Emoji in MySql table?
Qt parses a file that contains emoji characters. After that, the data is written to a MySql table of type - InnoDB, in an attribute of type varchar. After adding to the table (and in Qt itself when debugging), a part of Emoji, such as:
https://emojipedia.org/drop-of-blood/ https://emojipedia.org/tooth/ - are not displayed
What I already did:
Creating a table specifying attribute encoding:
"CREATE TABLE IF NOT EXISTS `"+tableName+"`(filed1 int not null AUTO_INCREMENT,
filed2 varchar(30),filed3 varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
filed4 varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,filed5 varchar(100),
PRIMARY KEY(filed1),INDEX USING BTREE(filed1)"");"
ALTER DATABASE <имя моей базы> CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
mysql clients, by the way, must also use the utf8mb4 encoding, otherwise emoji will also be lost when transcoding back and forth
As you know utf8mb4 is a MySQL define and not a real codec.- then how can mysql clients use it?
SET NAMES ("имя кодировки")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question