From 73222aa900cbcc081444394ecfd9db3dc114a9a8 Mon Sep 17 00:00:00 2001 From: Victor Berger <vberger@users.noreply.github.com> 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 972695844..28cabc12b 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<uint> utf32_string = body.toUcs4(); + for (auto &code : utf32_string) { // TODO: Be more precise here. if (code > 9000) fmtBody += QString("<span style=\"font-family: Emoji " "One; font-size: %1px\">") .arg(conf::emojiSize) + - QString(c) + "</span>"; + QString::fromUcs4(&code, 1) + "</span>"; else - fmtBody += c; + fmtBody += QString::fromUcs4(&code, 1); } return fmtBody; -- GitLab