Skip to content

HTTPCLIENT-2418 - Fix SimpleBody default charset handling for JSON content#823

Merged
arturobernalg merged 1 commit intoapache:masterfrom
arturobernalg:HTTPCLIENT-2418
Apr 18, 2026
Merged

HTTPCLIENT-2418 - Fix SimpleBody default charset handling for JSON content#823
arturobernalg merged 1 commit intoapache:masterfrom
arturobernalg:HTTPCLIENT-2418

Conversation

@arturobernalg
Copy link
Copy Markdown
Member

SimpleBody currently falls back to ASCII when Content-Type is application/json without an explicit charset, which breaks UTF-8 payloads.

@arturobernalg arturobernalg requested a review from ok2c April 16, 2026 06:47
return charset;
}
final String mimeType = contentType.getMimeType();
if (contentType.isSameMimeType(ContentType.APPLICATION_JSON)
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.

@arturobernalg Oh, god. This is ugly. Just use always UTF-8 and be done with it.

… content.Use UTF-8 instead of US-ASCII when no charset parameter is present.
@arturobernalg arturobernalg merged commit f75d283 into apache:master Apr 18, 2026
10 checks passed
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

Successfully merging this pull request may close these issues.

2 participants