1.前台中文参数用encodeURIComponent()进行编码,如:
var textName= encodeURIComponent(name);
2.对整个URL用encodeURI()进行编码,如:
var p = encodeURI("xxx?name="+textName);
3.后台解码
name = new String(name.getBytes("ISO-8859-1"),"UTF-8");
2024-01-24 12:49:46
1.前台中文参数用encodeURIComponent()进行编码,如:
var textName= encodeURIComponent(name);
2.对整个URL用encodeURI()进行编码,如:
var p = encodeURI("xxx?name="+textName);
3.后台解码
name = new String(name.getBytes("ISO-8859-1"),"UTF-8");