@mathias How do you recommend executing a substring on a Tweet, using Twitter's display_text_range, that is unicode aware? Twitter counts every character (including emojis) as one character, therefore a simple String.substring wont work with non BMP.
See https://mathiasbynens.be/notes/javascript-unicode#other-grapheme-clusters …: you really want Intl.Segmenter (WIP) for grapheme support. The next best thing is splitting by code point: [...string].slice(maxLength)
-
-
I'm running into issues with those conjoining emojis, like
, and [...string] doesn't account for that. It's very surprising that twitter-text doesn't account for this. Is there anyway to leverage Intl.Segmenter today? -
I believe the proposal repo links to a polyfill
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.