标签:
1、JS
function relaunch(id, service, submit) { var username = $("#id_username").text(); /* if (submit != username && submit != "null") { addAlert("Warning: " + "Permission Denied, Only Your Private Deploy Allowed To Relaunch !"); return false; } */ window.location = ‘/deployNext/?type=redo&deploy_id=‘+id+‘&service=‘+encodeURI(service); }
2、Python
>>> from urllib import quote >>> quote(‘魔兽‘) ‘%C4%A7%CA%DE‘
3、Django模板
<ul class="dropdown-menu"> <!-- <li><a href="/newJobBasic/">Basic</a></li> <li><a href="/newJobScript/">Script</a></li> <li><a href="/newJobPlaybook/">Playbook</a></li> --> {% for item in tmp_keys %} <li><a href="/deployNext/?type=new&service={{item | urlencode}}">{{item}}</a></li> {% endfor %} </ul>
参考资料:
python中的urlencode与urldecode :http://blog.csdn.net/haoni123321/article/details/15814111
【Web】Javascript、Python、Django模板配合处理URL Encode
标签:
原文地址:http://www.cnblogs.com/junneyang/p/5491987.html