diff --git a/src/libclient/utils/html.cpp b/src/libclient/utils/html.cpp index 8f201128a1..2adfd6439e 100644 --- a/src/libclient/utils/html.cpp +++ b/src/libclient/utils/html.cpp @@ -77,12 +77,21 @@ QString wrapEmoji(const QString &input, const QString &replacement) // emoji, but it should hopefully be close enough for our use case. // https://unicode.org/reports/tr51/#EBNF_and_Regex static QRegularExpression re{ - "(\\p{RI}\\p{RI}|\\p{Emoji}(\\p{EMod}|\\x{FE0F}\\x{20E3}?|[\\x{E0020}-" + "([aA]|\\p{RI}\\p{RI}|\\p{Emoji}(\\p{EMod}|\\x{FE0F}\\x{20E3}?|[\\x{E0020}-" "\\x{E007E}]+\\x{E007F})?(\\x{200D}(\\p{RI}\\p{RI}|\\p{Emoji}(\\p{EMod}" "|\\x{FE0F}\\x{20E3}?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?))*)+"}; - QString s = input; - s.replace(re, replacement); - return s; + static bool errorShown = false; + if(re.isValid()) { + QString s = input; + s.replace(re, replacement); + return s + " also 🌈 πŸ«ΆπŸ«‘πŸ’€πŸ”₯πŸŒ˜βœ…πŸ« "; + } else { + if(!errorShown) { + qWarning("Error compiling emoji regex: %s at position %d", qUtf8Printable(re.errorString()), int(re.patternErrorOffset())); + errorShown = true; + } + return input; + } } }