Are UTF16 (as used by for example wide-winapi functions) characters always 2 byte long?

前端 未结 8 1202
半阙折子戏
半阙折子戏 2021-02-09 06:23

Please clarify for me, how does UTF16 work? I am a little confused, considering these points:

  • There is a static type in C++, WCHAR, which is 2 bytes long. (alway
8条回答
  •  遇见更好的自我
    2021-02-09 07:08

    This Wikipedia article seems to be a good intro.

    UTF-16 (16-bit Unicode Transformation Format) is a character encoding for Unicode capable of encoding 1,112,064 numbers (called code points) in the Unicode code space from 0 to 0x10FFFF. It produces a variable-length result of either one or two 16-bit code units per code point.

提交回复
热议问题