What's the point of UTF-16?

前端 未结 5 814
太阳男子
太阳男子 2021-01-31 01:29

I\'ve never understood the point of UTF-16 encoding. If you need to be able to treat strings as random access (i.e. a code point is the same as a code unit) then you need UTF-3

5条回答
  •  梦毁少年i
    2021-01-31 01:42

    UTF-16 covers the entire BMP with single units - So unless you have a need for the rarer characters outside the BMP, UTF-16 is effectively 2 bytes per character. UTF-32 takes more space, UTF-8 requires variable-length support.

提交回复
热议问题