Escaping the slash when dump
This commit is contained in:
parent
f62b1f5d69
commit
a0c262d08b
@ -84,7 +84,7 @@ static int dump_string(const char *str, int ascii, json_dump_callback_t dump, vo
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* mandatory escape or control char */
|
/* mandatory escape or control char */
|
||||||
if(codepoint == '\\' || codepoint == '"' || codepoint < 0x20)
|
if(codepoint == '\\' || codepoint == '/' || codepoint == '"' || codepoint < 0x20)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* non-ASCII */
|
/* non-ASCII */
|
||||||
@ -102,11 +102,12 @@ static int dump_string(const char *str, int ascii, json_dump_callback_t dump, vo
|
|||||||
if(end == pos)
|
if(end == pos)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* handle \, ", and control codes */
|
/* handle \, /, ", and control codes */
|
||||||
length = 2;
|
length = 2;
|
||||||
switch(codepoint)
|
switch(codepoint)
|
||||||
{
|
{
|
||||||
case '\\': text = "\\\\"; break;
|
case '\\': text = "\\\\"; break;
|
||||||
|
case '/': text = "\\/"; break;
|
||||||
case '\"': text = "\\\""; break;
|
case '\"': text = "\\\""; break;
|
||||||
case '\b': text = "\\b"; break;
|
case '\b': text = "\\b"; break;
|
||||||
case '\f': text = "\\f"; break;
|
case '\f': text = "\\f"; break;
|
||||||
|
@ -1 +1 @@
|
|||||||
["\"\\/\b\f\n\r\t"]
|
["\"\\\/\b\f\n\r\t"]
|
Loading…
Reference in New Issue
Block a user