I'm having in my Annotation driven Spring MVC Java web application runned on jetty web server. (currently in maven jetty plugin).
I'm tryiing to do some AJAX support with one controller method returning just Strinh help text. Resources are in UTF8 encoding and so is the string, but my response from server comes with
content-ecoding: text/plain;charset=ISO-8859-1
even when my browser sends
Accept-Charset windows-1250,utf-8;q=0.7,*;q=0.7
I'm using somehow default configuration of spring
I have found hint to add this bean to configuration, but I think it's just not used, because it says it do not support used encoding and default one is used instead.
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes" value="text/plain;charset=UTF-8" />
</bean>
code of my controller is (note that this change of response type is not workng for me):
@RequestMapping(value = "ajax/gethelp")
public @ResponseBody String handleGetHelp(Locale loc, String code, HttpServletResponse response) {
log.debug("Getting help for code: " + code);
response.setContentType("text/plain;charset=UTF-8");
String help = messageSource.getMessage(code, null, loc);
log.debug("Help is: " + help);
return help;
}