Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape character "\\003\", get unexpected value #518

Closed
dota17 opened this issue Dec 20, 2019 · 2 comments
Closed

Escape character "\\003\", get unexpected value #518

dota17 opened this issue Dec 20, 2019 · 2 comments

Comments

@dota17
Copy link
Member

dota17 commented Dec 20, 2019

I changed line 48 of the test_parse.c to

single_basic_parse("\"\\003\"", 0);

The program threw an incorrect value.

48              single_basic_parse("\"\\003\"", 0);
(gdb) n
new_obj.to_string("\003")=null

@hawicz
Copy link
Member

hawicz commented Dec 22, 2019

That looks correct to me. Were you perhaps trying to do single_basic_parse("\"\\u0003\"", 0); ?

@dota17
Copy link
Member Author

dota17 commented Dec 23, 2019

Thanks,your are right. I checked RFC8259.
In chapter seven.

   To escape an extended character that is not in the Basic Multilingual
   Plane, the character is represented as a 12-character sequence,
   encoding the UTF-16 surrogate pair.  So, for example, a string
   containing only the G clef character (U+1D11E) may be represented as
   "\uD834\uDD1E".

      string = quotation-mark *char quotation-mark

      char = unescaped /
          escape (
              %x22 /          ; "    quotation mark  U+0022
              %x5C /          ; \    reverse solidus U+005C
              %x2F /          ; /    solidus         U+002F
              %x62 /          ; b    backspace       U+0008
              %x66 /          ; f    form feed       U+000C
              %x6E /          ; n    line feed       U+000A
              %x72 /          ; r    carriage return U+000D
              %x74 /          ; t    tab             U+0009
              %x75 4HEXDIG )  ; uXXXX                U+XXXX

JSON does not support \ddd and \xhh escape characters.

@dota17 dota17 closed this as completed Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants