當前位置:成語大全網 - 新華字典 - C++序列化json字符串對Unicode有哪些特殊處理

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

根據 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)才需要進行轉義。但轉義是可以的。