-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Should CharacterEncodingFilter apply to all assets? #5459
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
Comments
Relates to #1182 |
I wonder if we can check if the mime type starts with |
/cc @bclozel in case he has any suggestions |
I've created SPR-14126 to track this. |
I've just resolved SPR-14126 as won't fix, as I can't find any way to address this issue (I couldn't even get to a workaround). The only possible solution I can think of involves wrapping/caching responses, just like the I know that the encoding situation has been discussed many times in this bug tracker - and that there is no "sane default" as it all depends on the application, the culture of the app users, etc. Setting the Of course, we can discuss further options with the MVC team. |
In the meantime, and as suggested by @wilkinsona - I've created and solved SPR-14240, adding options to selectively force encoding on the request only. I believe changing the defaults in Boot to only use |
We need to update the javadoc on |
- Spring Boot used to offer the setting in application properties to specify a charset for all endpoints. However, they have now changed its behaviour (see spring-projects/spring-boot#5459) - I have now added an annotation to each endpoint type so each endpoint uses UTF-8 charset. - If we have an endpoint that returns images or other binary data, the produces value needs to be overridden. See https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/bind/annotation/RequestMapping.html#produces--
CharacterEncodingFilter
is auto-configured such that it appends a charset to all resources. The trouble is that this adds charset to resources such as png files. This causes confusion for people debugging their apps.I've overridden it like below, but wondering if there's a smarter way to address this.
The text was updated successfully, but these errors were encountered: