这个怎么解决呀?什么response.setCharacterEncoding("utf-8"),ServletActionContext.getResponse().setContentType("application/json;charset=UTF-8");都是试了,不行,各位为有好的办法吗?
换个Jquery包试试呢?我昨天刚弄的JSON数据中文的 每一个乱码的
最后将response.setCharacterEncoding("UTF-8")放在action方法的最前面就好了
"java" public void getChildArticleType(){ [size=x-small]ServletActionContext.getResponse().setCharacterEncoding("utf-8");[/size] List<ArticleType> articleTyeps = articleTypeService.queryArticleTypeByPid(pid); try { JSONArray jsonArticleTypes = JSONArray.fromObject(articleTyeps); PrintWriter out = ServletActionContext.getResponse().getWriter(); out.print(jsonArticleTypes); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
|