Hi all, I don't suggest seeing Javascript as a great example for Rust. It uses UTF-16, but was created back when UTF-16 was UCS-2, so two-code-unit codepoints are poorly supported in Javascript (e.g. you can't use them in regex character classes).

On 05/29/2014 12:16 AM, Bardur Arantsson wrote:
JavaScript:

   $ node
   > var s = "hï"; // Note the accent
   undefined
   > s.length;
   2

If you put that into NFD instead of NFC you get a different answer.
$ node
> "hï".length
2
> "hï".length
3

("hï" and "hï"'s length also differ in UTF-8: 3 bytes for NFC, 4 for NFD.)

-Isaac
(No opinion on the Rust question at hand.)

_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to