Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Garbled emoji sent out via federation #15520

Open
zotanmew opened this issue Feb 17, 2025 · 0 comments
Open

Garbled emoji sent out via federation #15520

zotanmew opened this issue Feb 17, 2025 · 0 comments
Labels
⚠️bug? This might be a bug

Comments

@zotanmew
Copy link
Contributor

zotanmew commented Feb 17, 2025

💡 Summary

Emoji sent out for federation are garbled - they are missing the variation selector \ufe0f. It is not possible to recover the original emoji from this state, as different emoji need it at different positions, and some even need it multiple times (requiring emoji.length factorial match attempts to recover the original sequence).

🥰 Expected Behavior

Emoji are sent out as valid, un-garbled unicode emoji codepoints.

🤬 Actual Behavior

Emoji are sent out as garbled emoji.

This happens in part due to this regex not being suitable for the purpose of detecting valid emoji sequences, and its match functionality stripping the variant selector (as it's meant for twemoji code point lookups, not for normalizing emoji sequences):
https://github.com/misskey-dev/misskey/blob/34f8345bc8330e0e53ab9e043a4b6db7b150636f/packages/backend/src/misc/emoji-regex.ts

On top of this, for some emoji, you are stripping it manually:

return unicode.match('\u200d') ? unicode : unicode.replace(/\ufe0f/g, '');

This causes interoperability issues with remote instances that enforce reactions to be valid unicode emoji sequences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚠️bug? This might be a bug
Projects
Development

No branches or pull requests

1 participant