Skip to content

MINOR: [c++] escape form-feed in schema JSON - #4099

Open
aaltay wants to merge 1 commit into
apache:mainfrom
aaltay:fix-cpp-escape-form-feed
Open

aaltay wants to merge 1 commit into
apache:mainfrom
aaltay:fix-cpp-escape-form-feed

Conversation

@aaltay

@aaltay aaltay commented Nov 17, 2026

Copy link
Copy Markdown
Member

What is the purpose of the change

escape() in lang/c++/impl/NodeImpl.cc emits a raw 0x0c byte (s += '\f') instead of \f (s += '\\'; s += 'f';) when serializing schema doc strings and string default values, whereas \b, \n, \r, \t, \", and \\ are all escaped as two-character sequences. Any schema containing a form-feed character therefore serializes to invalid JSON (RFC 8259 section 7) in Avro file headers and toJson() output.

Verifying this change

This change added tests and can be verified as follows:

  • Extended lang/c++/test/SchemaTests.cc (schemasToCompact / compactSchemas) with both an escaped \\f and a raw \f in a record doc string, verifying both serialize to \\f in the compacted JSON schema (fails before the fix and passes with it).

Documentation

  • Does this pull request introduce a new feature? no

NodeImpl.cc::escape() emitted a raw 0x0c byte instead of \f when
serializing schema doc strings and string default values, producing
invalid JSON (RFC 8259 section 7) in Avro file headers and serialized
schemas whenever a string contained a form-feed character.
@github-actions github-actions Bot added the C++ Pull Requests for C++ binding label Nov 17, 2026
@aaltay

aaltay commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

Tagging for reviews: @martin-g

@aaltay

aaltay commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

Tagging for reviews: @Fokko

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C++ Pull Requests for C++ binding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant