mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Fix unicode handling of replaceEmoji (#84)
This commit is contained in:
parent
35355756e5
commit
73222aa900
1 changed files with 4 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue