var url="
http://127.0.0.1/test/test.nsf/testAgent?openagent";
function ajax_keyword(url) {
xmlhttp = createXmlHttpRequest();
xmlhttp.onreadystatechange = handleSearchSuggest;
xmlhttp.open("post",url, true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=GB2312");
xmlhttp.send("keyword=" + keyword.value);
}
结果在domino
代理中获取 send过去的参数“keyword”
中文出现
乱码,怎么处理??
解决方法:
xmlhttp.send("keyword=" + keyword.value);
在js代码中用encodeURIComponent()对参数keyword做转码,即:改成 xmlhttp.send("keyword=" + encodeURIComponent(keyword.value));
然后在接受的代理
再用 Evaluate 去执行公式用 @URLDecode 对传递进来的参数再次转码 ,就可以得到中文参数
dim s as new notessession
dim cdoc as notesdocument
说明:
encodeURIComponent是将中文、韩文等特殊字符转换成utf-8格式的url编码,所以如果给后台传递参数需要使用encodeURIComponent时需要后台解码对utf-8支持(form中的编码方式和当前页面编码方式相同)
encodeURIComponent不编码字符有71个:!, ',(,),*,-,.,_,~,0-9,a-z,A-Z
|