Some applications like PowerShell's Invoke-RestMethod count on charset information to display data correctly. An undocumented breaking change in 8.0 may cause applications to show non-ASCII characters incorrectly:
From version 8.0.0, Elasticsearch does not send the Content-Type response header as application/json;charset=utf-8 but simply application/json. According to RFC 8259, sending the charset information is not required when transferring JSON data, as UTF is the default encoding.
The workaround is for clients to include Accept: application/json; charset=UTF-8 header in requests.
Elasticsearch Version
8.0+
Installed Plugins
No response
Java Version
bundled
OS Version
N/A
Problem Description
Some applications like PowerShell's Invoke-RestMethod count on charset information to display data correctly. An undocumented breaking change in 8.0 may cause applications to show non-ASCII characters incorrectly:
From version 8.0.0, Elasticsearch does not send the
Content-Type
response header asapplication/json;charset=utf-8
but simplyapplication/json
. According to RFC 8259, sending the charset information is not required when transferring JSON data, as UTF is the default encoding.The workaround is for clients to include
Accept: application/json; charset=UTF-8
header in requests.We believe this came as a side effect of content-type parsing refactoring needed for the REST API compatibility added in 8.0 (https://github.com/elastic/elasticsearch/pull/61427).
This is a request to confirm the above finding and add the change to our breaking changes documentation. Thx!
Steps to Reproduce
version 8:
We get in the response: < content-type: application/json;charset=utf-8
We get in the response: < content-type: application/json
version 7:
We get in the response: < content-type: application/json; charset=UTF-8
Logs (if relevant)
No response