Recenlty我在服务器的JSON响应波兰字符有大问题。我有这个简单的Ajax请求:在服务器端春季mvc jquery ajax响应作为json编码问题
jQuery.ajax("/GetSimpleRuleList",
{
type:"GET",
responseType:"application/json;charset=utf-8",
contentType:"application/json;charset=utf-8",
cache:false
}).done(function (data)
{
console.log(data);
//nevermind here
});
和适当的控制器:
@RequestMapping(value = "/GetSimpleRuleList", method = RequestMethod.GET)
public
@ResponseBody
String getRuleList(ServletResponse response)
{
//magically getting my list here
response.setCharacterEncoding("UTF-8");
return //Using JACKSON ObjectWriter here
}
现在我100%肯定我从哪里拿数据是从上encoidng服务器端和数据库好吧,没问题。 但是当涉及到读响应从服务器,它是:
???
代替波兰语炭等:
ąćź
而且接收来自服务器的响应时,在发送用数据的请求是它不仅不能正确编码。
在我的web.xml中,我已经过滤了字符编码。
对此有何帮助?我没有想法。
确切重复http://stackoverflow.com/questions/12105617/spring-3-1-mvc-getting-character-encoding-error-while-using-responsebody-anno –