micronaut-views
micronaut-views copied to clipboard
No charset encoding specified on view responses
Expected Behavior
Unless otherwise specified, HTTP responses from Micronaut (Views) should declare that they are in UTF-8 in the Content-Type
header.
Actual Behaviour
No encoding is specified, leaving the browser to guess, and sometimes it guesses wrong.
Steps To Reproduce
- Make a view that includes the output of something like
DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).format(LocalDateTime.now())
which should yield a unicode NNBSP character before the "AM" or "PM" part. - Load it in Chrome.
- Observe mojibake
- Add a
<meta charset="utf-8"/>
tag to the header. - Observe that it's now fixed.
Environment Information
macOS 14, Chrome
Example Application
No response
Version
4.3.6