Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS api proxy controller doesn't encode writable response according to defined charset #2250

Open
bivapa opened this issue Nov 15, 2024 · 0 comments

Comments

@bivapa
Copy link

bivapa commented Nov 15, 2024

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

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

No branches or pull requests

1 participant