解决IE在URL中对中文做的手脚
使用AjaxUpload上传图片后,需要将图片的URL返回到页面来,如果图片文件名中有中文,在IE接收到的json中,中文都变成了乱码,FF、Chrome、Safari都正常。 这时只要在java代码中加入下面两句:
response.setCharacterEncoding("UTF-8");response.setContentType("text/html; charset=UTF-8");Gson gson = new Gson();response.getOutputStream().write(gson.toJson(resp).getBytes());就行了。
?