我终于克服了将完整的utf-8
字符串从javascript传递到python的问题,但是现在在python中接收到字符串时,javascript端的回车符"\n"
丢失了。我应该做点什么?在
function saveMeetingComments(){
var komments = $('#cmt_t').val()
var d = new Date();
var commentsText = $('#cmt_t').val()
var abc = ''
var request = par_makeHttpObject();
commentsText = stringTranslate(commentsText,"'",'`');
request.open("POST", "saveMeetingNote?clientID="+clid_+
"&co_ID="+coid_+
"&msgDate="+dateFormat(d, "dddd, mmmm dS, yyyy, h:MM TT")+
"&MeetType="+AGM_+
"&MeetDate="+meetdate+"-"+
"&Comments="+commentsText , false);
request.send();
$('#cmt_t').val('');
parkAll();
}
注释是唯一可能有回车符的变量。在Python端,代码如下:
^{pr2}$检查注释显示\n
都不见了。。。在
TIA公司
丹尼斯
在将所有变量连接到POST请求之前,请对所有变量使用
encodeURIComponent()
。在似乎在将数据粘贴到POST请求URL之前,您没有对数据进行URL编码。换行并不是唯一可能丢失的东西。当有人在注释字段中输入
&
时会发生什么?在使用^{} 修复此问题:
在服务器端,要解码此用法:
^{pr2}$相关问题 更多 >
编程相关推荐