django中怎样对url进行urlencode??

35 views
Skip to first unread message

babatu

unread,
Sep 3, 2008, 3:13:46 AM9/3/08
to Django-Chinese
django中怎样对url进行urlencode??

当url中包含中文时, 不同浏览器对url中的中文处理不一样。



类似这样

http://bendi.koubei.com/search/searchlocal.html?option.dfcity=&search...

hairui

unread,
Sep 3, 2008, 3:34:49 AM9/3/08
to Django-Chinese


用 urllib.urlencode(query[, doseq])

详见:http://fy.py3k.cn/p/pydoc/library/urllib.html#urllib.urlencode

欢迎参加翻译,;)

babatu

unread,
Sep 3, 2008, 10:29:00 AM9/3/08
to Django-Chinese
对于django初学,

urlencode是写在template里还是 view里?

给个例子好吗?谢谢

babatu

unread,
Sep 3, 2008, 10:24:54 PM9/3/08
to Django-Chinese
在template 里 <a href='{{"关键词"|urlencode}}'>dd</a>
> > >http://bendi.koubei.com/search/searchlocal.html?option.dfcity=&search...- 隐藏被引用文字 -
>
> - 显示引用的文字 -
Reply all
Reply to author
Forward
0 new messages