【发布时间】:2015-04-15 18:12:49
【问题描述】:
我使用 django 建立一个博客网站。我使用 python urllib.quote 函数对 url 字符串进行编码而不提交表单。例如,在我的 html 文件中,有这样的 href 链接:
http://example.com/post/?tag=new%20tag (1)
(1) 是我从 (2) 编码的链接:
http://example.com/post/?tag=new tag (2)
这与表单 GET 方法有点不同,其中“new tag”被编码为“new+tag”。只要输出 url 不包含空格,我都可以。
但是,在我点击网页中的链接 (1) 后,浏览器中生成的 url 看起来像链接 (2)(带空格)。我应该将链接保留为 (2) 吗?如何使输出 url 为 (1) 或以下标准:
http://example.com/post/?tag=new+tag (3)
【问题讨论】:
标签: html django url get encode