我终于克服了将完整字符串从 javascript 传递到 python 的问题,但是现在在 python 中接收字符串时缺少 Javascript 端存在utf-8
的回车。"\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 端,代码如下:
def saveMeetingNote(self, **kwargs):
clientID = kwargs['clientID']
co_ID = kwargs['co_ID']
MessageDate = kwargs['msgDate']
MeetingType = kwargs['MeetType']
MeetingDate = kwargs['MeetDate']
Comments_ = kwargs['Comments']
coName = dennislib.CompanyCoID2NAME(co_ID)[0]['FName']
ret = dennislib.saveMeetingNotes(clientID,co_ID,MessageDate,MeetingType,MeetingDate,Comments_,coName)
return
saveMeetingNote.exposed = True
检查 Comments_ 表明所有的\n
都消失了......
TIA
丹尼斯