Specify the charset of HTTPServer response - #564
Conversation
In some Operational Systems (Like IBM Z/OS and IBM Z/Unix) the JRE runs with a charset different of UTF-8, those default charsets produce wrong behavior and truncated responses. To avoid this kind of situations I put the specifc charset in the output writer. This create a consistent response between different platforms. Signed-off-by: João Paulo Binda Delboni <joaopdelboni@gmail.com>
|
Is there anywhere else we need this? |
Only this class for the tested use cases. But this class are used by jmx_exporter (jmx_prometheus_javaagent and jmx_prometheus_httpserver) those projects will be affected by this change. |
|
We've other places we produce HTTP requests/responses with metrics, would you mind checking them? |
To prevent problems with encoding in some Operational Systems we set the charset of Graphite Charset. Signed-off-by: João Paulo Binda Delboni <joaopdelboni@gmail.com>
|
@brian-brazil sorry for the delay, I've made a review on the other projects of the repository and thats my view:
|
We should always expose UTF-8, no matter what the request headers say. |
|
Ok Brian, I made a mistake on the previous description, the spring boot have the property named spring.http.encoding.charset, this property have a default value defined to UTF-8. I can made a change to in the metrics specific endpoint aways return values encoded in UTF-8, this will result in a method with raw bytearray return. This not smell good. But i can do. What do you think about ? |
|
It sounds like Spring do the right thing by default, so we could leave that until it's actually a problem for someone. |
|
Great, so at this point it is all changes done. |
|
Thanks! |
In some Operational Systems (Like IBM Z/OS and IBM Z/Unix) the JRE runs with a charset different of UTF-8, those default charsets produce wrong behavior and truncated responses.
To avoid this kind of situations I put the specifc charset in the output writer.
This create a consistent response between different platforms.