Fix emoji detection

The previous code considered "123" to be an emoji
This commit is contained in:
Tobias Fella
2024-10-10 21:32:53 +02:00
parent 0bda65b5ac
commit 9ef342e448

View File

@@ -20,7 +20,6 @@ bool QmlUtils::isEmoji(const QString &text)
{
return Utils::isEmoji(text);
}
bool QmlUtils::isValidJson(const QByteArray &json)
{
return !QJsonDocument::fromJson(json).isNull();
@@ -51,7 +50,7 @@ bool Utils::isEmoji(const QString &text)
}
auto first = text.mid(from, to - from).toUcs4()[0];
if (!u_hasBinaryProperty(first, UCHAR_EMOJI)) {
if (!u_hasBinaryProperty(first, UCHAR_EMOJI_PRESENTATION)) {
return false;
}
from = to;