C++序列化json字符串对Unicode有哪些特殊处理

2025-03-06 14:41:05
推荐回答(1个)
回答1:

根据 ECMA-404 [1] 第 7 节:
All characters may be
placed within the quotation marks except for the characters that must be escaped: quotation mark (U+0022),
reverse solidus (U+005C), and the control characters U+0000 to U+001F. U+0000 至 U+001F 字符是必须转义,当中除 BS、HT、LF、FF、CR 有特殊转义符,其他都需要转义成 "\uXXXX" 的形式。

Any code point may be represented as a hexadecimal number.
所有码点可以表示为"\uXXXX" 形式。对于 U+2028 和 U+2029,[1] 并不要求转义。可能是在某些应用中有此需求(如有bug)才需要进行转义。但转义是可以的。