From Dev.to
Why a Twitter/X character counter can't just use JavaScript .length
When you're writing for X, one character is not always one counted unit. JavaScript strings use UTF-16; visual glyphs can span several code points; and X's public weighted-character rules treat many C...
