.@BrendanEich can i ask you a js Q? all javascript string methods break when string contains emoji. is there plan to fix this? and how?
-
-
Replying to @xah_lee
How do you define “break”? JS was standardized in ‘90s when java and windows thought 16 bits were enough. Cc:
@mathias@FakeUnicode1 reply 0 retweets 0 likes -
The fix (to prevent surrogate pair splits at least) is Array.from() and spread operator [...]. There isn't really a way to fix emoji splitting. "Software engineer’s credo: 'I sit amid an infinitely-regressing fractal tower of janky bullshit, building the layer above me.'"
1 reply 0 retweets 4 likes -
Replying to @FakeUnicode @BrendanEich and
Fake “Unicode.” ↙️ Retweeted Fake “Unicode.” ↙️
The list of emoji sequences (ZWJs, flags, subregion flags, skin tones, keycaps, etc) changes per year, per platform, per vendor, and even per region (no
in China).
You can either use an external library or maintain a fragile mechanism regex:https://twitter.com/FakeUnicode/status/845406552097878016 …Fake “Unicode.” ↙️ added,
2 replies 1 retweet 1 like -
Brendan and friends. I understand workarounds. But the fact remain. All string methods “break” when string contain codepoint > 2^16. "
".length===2
"
".padStart(2,"x")==="
"
"
".slice (0,1)!=="
"
so no plan in ECMA to fix this?1 reply 0 retweets 2 likes -
No plans, because “don’t break the web”. Capiche?
2 replies 0 retweets 7 likes -
FWIW I wrote about this and explained workarounds here: https://mths.be/jsu For emoji (non-)splitting in particular, the upcoming Intl.Segmenter proposal can help. cc
@littledan1 reply 1 retweet 6 likes -
Replying to @mathias @BrendanEich and
unicode normalization and combining char are a different level of problem, that no lang can easily say they have a solution. but all string methods broken for string containing simple chars is the problem of js, that all other modern langs don't have.
3 replies 0 retweets 0 likes
JavaScript *does* have a solution for normalization: String.prototype.normalize.
-
-
Replying to @mathias @BrendanEich and
Yes. I read it in your excellent blog https://mathiasbynens.be/notes/javascript-unicode …
0 replies 0 retweets 1 likeThanks. Twitter will use this to make your timeline better. UndoUndo
-
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.