-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Expected Behavior
When I define a controller with a Writable response type and I set a specific charset on the response object I expect the rendered content to be encoded in that specified charset.
Actual Behaviour
When I define a controller with a Writable response type and I set a specific charset on the response object the rendered content is always encoded in UTF-8.
Consequently, non-UTF-8 charsets (like Latin-1) can't be reliably used in the API proxy configuration where content is rendered via views for example (which are backed internally by the Writable type as well).
ℹ️ The Netty based controller does take into account the specified charset.
ℹ️ Worked on Micronaut v4.4.3 and stopped working after v4.5.0.
Steps To Reproduce
- Clone the example application
- Run .
/mvnw -P server clean test
- The tests will pass for the Netty based configuration ✅
- Run .
/mvnw -P serverless clean test
- The test
testWritableServerlessControllerEncodesCorrectCharacters
will fail ❌ due to mismatch between the response Latin-1 charset and the actual encoding of the content which is UTF-8:expected: <français> but was: <français>
Environment Information
Java 17
Example Application
https://github.com/bivapa/micronaut-serverless-char-encoding-bug-report
Version
4.6.3