- &namecode="+escape(chname.val())
DJANGO获取:
namecode = jsUnescape(request.GET.get('namecode',''))
解码函数:
"""
javascript的解码函数
"""
def jsUnescape(s):
chr_list = s.split("%u")
chr_list = [unichr(int(c, 16)) for c in chr_list if c.strip() != ""]
return "".join(chr_list)
views.py
注意其类型为unicode的。
传递到后端namecode.encode("utf-8").走thrift的方式调用!