How should escaped unicode be handled by json parsers and encoders?

前端 未结 2 499
既然无缘
既然无缘 2021-02-06 05:19

The json spec allows for escaped unicode in json strings (of the form \\uXXXX). It specifically mentions a restricted codepoint (a noncharacter) as a valid escaped codepoint. Do

2条回答
  •  攒了一身酷
    2021-02-06 06:06

    When you decode, it seems that this would be an appropriate use for the unicode replacement character, U+FFFD.

    From the Unicode Character Database:

    • used to replace an incoming character whose value is unknown or unrepresentable in Unicode
    • compare the use of U+001A as a control character to indicate the substitute function

提交回复
热议问题