Skip to content

Commit

Permalink
[C++] Do not escape solidus in JSON output (#2929)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 authored Jun 7, 2024
1 parent 1e5c317 commit 23b0e96
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion lang/c++/impl/json/JsonIO.hh
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ class AVRO_DECL JsonGenerator {
switch (*p) {
case '\\':
case '"':
case '/':
escape(*p, b, p);
break;
case '\b':
Expand Down
4 changes: 3 additions & 1 deletion lang/c++/test/JsonTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ TestData<const char *> stringData[] = {
{R"("\U000a")", EntityType::String, "\n", R"("\n")"},
{R"("\u000a")", EntityType::String, "\n", R"("\n")"},
{R"("\"")", EntityType::String, "\"", R"("\"")"},
{R"("\/")", EntityType::String, "/", R"("\/")"},
// While a solidus may be escaped according to the JSON standard, it need not be escaped.
{R"("/\/")", EntityType::String, "//", R"("//")"},
{R"("\b\f\n\r\t")", EntityType::String, "\b\f\n\r\t", R"("\b\f\n\r\t")"},
{R"("\u20ac")", EntityType::String, "\xe2\x82\xac", R"("\u20ac")"},
{R"("\u03c0")", EntityType::String, "\xcf\x80", R"("\u03c0")"},
{R"("hello\n")", EntityType::String, "hello\n", R"("hello\n")"},
Expand Down

0 comments on commit 23b0e96

Please sign in to comment.