js取后台json数据 中文乱码

System.out.println(fileName);
fileName = URLEncoder.encode(fileName,"UTF-8");
System.out.println(fileName);
JSONObject obj = new JSONObject();
obj.put("name", fileName);
out.println(obj.toJSONString());



var h0='('+serverData+')';
var h = eval(h0);
var nam = h.name;
nam = decodeURI(nam);
var ss = "name="+h.name+" nameDecode="+nam;
//alert(ss);
document.getElementById("serverData").innerHTML = ss;


你可能感兴趣的:(Javascript,html,exception,struts)