Fix emoji detection
The previous code considered "123" to be an emoji
This commit is contained in:
@@ -20,7 +20,6 @@ bool QmlUtils::isEmoji(const QString &text)
|
|||||||
{
|
{
|
||||||
return Utils::isEmoji(text);
|
return Utils::isEmoji(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlUtils::isValidJson(const QByteArray &json)
|
bool QmlUtils::isValidJson(const QByteArray &json)
|
||||||
{
|
{
|
||||||
return !QJsonDocument::fromJson(json).isNull();
|
return !QJsonDocument::fromJson(json).isNull();
|
||||||
@@ -51,7 +50,7 @@ bool Utils::isEmoji(const QString &text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto first = text.mid(from, to - from).toUcs4()[0];
|
auto first = text.mid(from, to - from).toUcs4()[0];
|
||||||
if (!u_hasBinaryProperty(first, UCHAR_EMOJI)) {
|
if (!u_hasBinaryProperty(first, UCHAR_EMOJI_PRESENTATION)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
from = to;
|
from = to;
|
||||||
|
|||||||
Reference in New Issue
Block a user