From 73222aa900cbcc081444394ecfd9db3dc114a9a8 Mon Sep 17 00:00:00 2001 From: Victor Berger Date: Mon, 2 Oct 2017 19:52:21 +0200 Subject: [PATCH] Fix unicode handling of replaceEmoji (#84) --- src/TimelineItem.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/TimelineItem.cc b/src/TimelineItem.cc index 97269584..28cabc12 100644 --- a/src/TimelineItem.cc +++ b/src/TimelineItem.cc @@ -371,17 +371,17 @@ TimelineItem::replaceEmoji(const QString &body) { QString fmtBody = ""; - for (auto &c : body) { - int code = c.unicode(); + QVector utf32_string = body.toUcs4(); + for (auto &code : utf32_string) { // TODO: Be more precise here. if (code > 9000) fmtBody += QString("") .arg(conf::emojiSize) + - QString(c) + ""; + QString::fromUcs4(&code, 1) + ""; else - fmtBody += c; + fmtBody += QString::fromUcs4(&code, 1); } return fmtBody;