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

Multipart processing @Body annotation decodes to string using incorrect charset #829

Open
tfield opened this issue Nov 9, 2024 · 0 comments

Comments

@tfield
Copy link

tfield commented Nov 9, 2024

Expected Behavior

When using the @Body annotation to extract multipart parameters into a Map<String,List>, the list of parameter values should be decoded to strings as UTF-8

Actual Behaviour

The list of parameter values is decoded to strings using latin1. The strings need to be decoded to bytes then re-converted to strings using utf-8.

Steps To Reproduce

See repository linked below. But to roll your own:

  • create a form that posts strings to a controller using multipart/form-data
  • add non-latin1 characters to the string (e.g. smart quotes)
  • decode values using @Body Map<String,List>
  • observe incorrect decoding
  • convert to bytes using latin1
  • convert back to string using utf8
  • observe correct decoding

Environment Information

  • Micronaut 4.4.2
  • Micronaut Servlet (Tomcat)
  • Multipart enabled
  • MacOS 15.1

Example Application

https://github.com/tfield/micronaut-servlet-multipart

Version

4.4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant