since JS uses UTF-16 for string encoding, it uses surrogate pairs to encode high elements, and native string operations count code units. since lib.wc.substr is currently written based on charCodeAt, we end up incorrectly splitting surrogate pairs.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt
example:
U+2099d 𠦝 lib.wc.substr('\u{2099d}', 0, 1) -> "�"
U+1f60e 😎 lib.wc.substr('\u{1f60e}', 0, 1) -> "�"
ideally lib.wc.substr should be operating on graphemes, but that's a bit more work (and tracked elsewhere), so we should be able to fix up this one func in the meantime.
Comment 1 by bugdroid1@chromium.org
, Aug 21 2017