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

Unicode emojis are throwing off emote replacement #65

Open
BenDMyers opened this issue Jan 17, 2022 · 0 comments
Open

Unicode emojis are throwing off emote replacement #65

BenDMyers opened this issue Jan 17, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@BenDMyers
Copy link
Owner

Unicode emojis (as in, the emojis you use your device's native emoji keyboard to type) are messing with the string replacement indices for adding emote <img> strings to the message. This appears to be because emojis are multiple bytes (at least two, sometimes more depending on the emoji). Multiple emojis cause the emote <img> string replacement to be even more offset.

A few examples:

🦖 somean3CoolTuna

  • Result: 🦖 somean3CoolTuna
  • Result as HTML string:
🦖<img alt=" somean3CoolTun" data-twitch-emote=" somean3CoolTun" data-twitch-emote-id="emotesv2_3e72737cb25d4278971dd4988b48992c" src="https://static-cdn.jtvnw.net/emoticons/v2/emotesv2_3e72737cb25d4278971dd4988b48992c/default/light/3.0">a
  • Expected: 🦖 somean3CoolTuna
  • Expected HTML string:
🦖 <img alt="somean3CoolTuna" data-twitch-emote="somean3CoolTuna" data-twitch-emote-id="emotesv2_3e72737cb25d4278971dd4988b48992c" src="https://static-cdn.jtvnw.net/emoticons/v2/emotesv2_3e72737cb25d4278971dd4988b48992c/default/light/3.0">

🦖 🦖 🦖 🦖 hellooooooooo somean3A11Y

  • Result: 🦖 🦖 🦖 🦖 hellooooooooo somean3A11Y
  • Result as HTML string:
🦖 🦖 🦖 🦖 helloooooo<img alt="ooo somean3" data-twitch-emote="ooo somean3" data-twitch-emote-id="emotesv2_c13dfc82e82d4c05b41f1dfde9dbd38e" src="https://static-cdn.jtvnw.net/emoticons/v2/emotesv2_c13dfc82e82d4c05b41f1dfde9dbd38e/default/light/3.0">A11Y
  • Expected: 🦖 🦖 🦖 🦖 hellooooooooo somean3A11Y
  • Expected HTML string:
🦖 🦖 🦖 🦖 hellooooooooo <img alt="somean3A11Y" data-twitch-emote="somean3A11Y" data-twitch-emote-id="emotesv2_c13dfc82e82d4c05b41f1dfde9dbd38e" src="https://static-cdn.jtvnw.net/emoticons/v2/emotesv2_c13dfc82e82d4c05b41f1dfde9dbd38e/default/light/3.0">
@BenDMyers BenDMyers added the bug Something isn't working label Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant