Skip to content

Fixes #1827: Escape custom quote char when CharacterEscapes are configured - #1826

Merged
cowtowncoder merged 10 commits into
FasterXML:3.xfrom
ubeddulla:custom-escapes-quote-char
Nov 15, 2026
Merged

cowtowncoder merged 10 commits into
FasterXML:3.xfrom
ubeddulla:custom-escapes-quote-char

Conversation

@ubeddulla

@ubeddulla ubeddulla commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1827

UTF8JsonGenerator and WriterBasedJsonGenerator.setCharacterEscapes() now pass the custom ASCII escape table through a new JsonGeneratorBase._escapesWithQuoteChar() helper. If the table doesn't already escape the configured quote char, it's copied (the caller's array isn't mutated) and the quote char gets an escape: backslash-escaped for ' / ", ESCAPE_STANDARD otherwise. Tables that already escape it are returned unchanged.

Test: CustomQuoteCharTest.aposQuotingWithCustomEscapes covers both the Writer and OutputStream generators.

@cowtowncoder cowtowncoder added the need-issue PR submitted without matching issue: please create an issue, or add a link to one if one exists label Nov 15, 2026
@cowtowncoder

Copy link
Copy Markdown
Member

Let's split problem description into actual Issue, leaving PR for fix and implementation aspects (hence need-issue label)

@ubeddulla

Copy link
Copy Markdown
Contributor Author

Makes sense, filed #1827 with the problem description and trimmed the PR description down to the fix.

@cowtowncoder cowtowncoder added the cla-received PR already covered by CLA (optional label) label Nov 15, 2026
@cowtowncoder cowtowncoder changed the title Escape custom quote char when CharacterEscapes are configured Fixes #1827: Escape custom quote char when CharacterEscapes are configured Nov 15, 2026
@cowtowncoder cowtowncoder removed the need-issue PR submitted without matching issue: please create an issue, or add a link to one if one exists label Nov 15, 2026
* Helper method for making sure that ASCII escape codes from custom
* {@link CharacterEscapes} still escape the quote character in use,
* if the custom definitions do not already do so.
*/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@since 3.4

cowtowncoder and others added 8 commits November 15, 2026 12:37
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…SInCE tags

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rload

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cowtowncoder cowtowncoder added this to the 3.4.0 milestone Nov 15, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cowtowncoder
cowtowncoder merged commit d0e101d into FasterXML:3.x Nov 15, 2026
4 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📈 Overall Code Coverage

Metric Coverage Change
Instructions coverage 87.29% 📈 +0.030%
Branches branches 82.30% 📈 +0.020%

Overall project coverage from JaCoCo test results. Change values compare against the latest base branch build.

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

Labels

3.4 cla-received PR already covered by CLA (optional label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom CharacterEscapes drop escaping of non-default quoteChar

2 participants