为了jQuery方便使用,项目用上utf-8
使用ajax中回调xml数据时,服务器端需要:String xmlData="...";//回调的xml数据response.setContentType("text/xml;charset=utf-8");ServletOutputStream ouputStream = response.getOutputStream();byte[] bytes =xmlData.getBytes("utf-8");//设置utf-8编码方式ouputStream.write(bytes, 0, bytes.length);ouputStream.flush();ouputStream.close();[@more@]Java Web项目几处设置编码方式的地方:1、接受客户端请求的Servlet中对request设置编码方式:request.setCharacterEncoding("utf-8");