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

前端 未结 8 1196
半阙折子戏
半阙折子戏 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 06:49

    According to the Unicode FAQ it could be

    one or two 16-bit code units

    Windows uses 16 bit chars - probably as Unicode was originally 16 bit. So you don't have an exact map - but you might be able to get away with treating all strings you see as just containing 16 but unicode characters,

提交回复
热议问题