-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
Morten Egelund Rasmussen opened SPR-6443 and commented
I have a @Controller class defined as a REST webservice endpoint. It has a method, which is annotated with @ResponseBody.
Class looks something like this:
@Controller
@RequestMapping("/foo")
public class Foo {
@RequestMapping(value="/foobar", method=RequestMethod.GET)
@ResponseBody
public string getFoobar() {
// Do something that returns some UTF-8 stuff (probably some XML).
}
}
It seems that it always returns content encoded in ISO-8859-1, even if I have a CharacterEncodingFilter defined first in the chain like:
<filter>
<filter-name>CharacterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
I have debugged and printed the string output to the logs, and it goes to the logfile just fine in UTF-8. However, it ends out in the browser as ISO-8859-1.
Issue Links:
- @ResponseBody overwrites ContentType [SPR-6559] #11225
@ResponseBodyoverwrites ContentType
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid