Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Because char's range has a hole from 0xd800 to 0xd8ff (surrogate pairs [1]) so not all u16 values (or larger) can be safely converted to char.

[1] https://en.wikipedia.org/wiki/UTF-16#U+D800_to_U+DFFF



Additionally Unicode only goes up to U+10FFFF (1,114,112 code points) which is far short of a full 32 bits (4,294,967,295 values).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: