PHP and C++ for UTF-8 code unit in reverse order in Chinese character

前端 未结 1 1186
半阙折子戏
半阙折子戏 2020-12-12 05:24

The unicode code point for the Chinese word 你好 is 4F60 , 597D respectively. which I got from this tool http://rishida.net/tools/conversion/

The console application b

相关标签:
1条回答
  • 2020-12-12 06:05

    They're both correct. The difference is in endian-ness.

    My guess is that UTF-16 will output the string as little-endian by default. You can enforce big-endianness by using UTF-16BE instead.

    That, or the exact reverse ;)

    Note that these are not unicode codepoints, but rather the UTF-16BE/LE/UCS-2 byte representation. Codepoints are a different set of numbers.

    EDIT: Using UTF-16LE in mb_convert_encoding will give you to the reverse representation.

    0 讨论(0)
提交回复
热议问题