We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Trying to format a table with emoji results in wrong whitespace padding:
| First column | Second column | Third column | |--------------|---------------|--------------| | First row | ✅ | ❌ | | Second row | ✅ | ❌ |
JavaScript assumes each Unicode character taking up 2 bytes, but some characters take up more bytes (for example emojis):
// This is wrong '✅'.length === 2 > true
Using Intl.Segmenter fixes this issue:
// Much better! [...new Intl.Segmenter().segment('✅')].length > 1 [...new Intl.Segmenter().segment('✅ hello world')].length > 13
See also: How to count the correct length of a string with emojis in javascript?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Trying to format a table with emoji results in wrong whitespace padding:
JavaScript assumes each Unicode character taking up 2 bytes, but some characters take up more bytes (for example emojis):
Using Intl.Segmenter fixes this issue:
See also: How to count the correct length of a string with emojis in javascript?
The text was updated successfully, but these errors were encountered: