Closed syimyuzya closed 2 years ago
str.split('') does NOT split the string by Unicode code points but by UTF-16 code units, causing non-BMP kanji being split into surrogate pairs.
str.split('')
The correct way for turning a string into an array is str.split() or [...str].
str.split()
[...str]
str.split('')
does NOT split the string by Unicode code points but by UTF-16 code units, causing non-BMP kanji being split into surrogate pairs.The correct way for turning a string into an array is
str.split()
or[...str]
.