Fix the tag span generation for tags with nonascii characters (#2700)

* Update mention and tag regexes from mastodon

* Normalize nonascii tag names the same way that mastodon does
This commit is contained in:
Levi Bard 2022-09-17 19:06:45 +02:00 committed by GitHub
commit 5d09a67b52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 3 deletions

View file

@ -124,7 +124,7 @@ fun setClickableText(
@VisibleForTesting
fun getTagName(text: CharSequence, tags: List<HashTag>?): String? {
val scrapedName = text.subSequence(1, text.length).toString()
val scrapedName = normalizeToASCII(text.subSequence(1, text.length)).toString()
return when (tags) {
null -> scrapedName
else -> tags.firstOrNull { it.name.equals(scrapedName, true) }?.name