mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
unicode: Fixed urlencode filter to handle IRI portions and map them to URI
portions correctly. git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5273 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e4cd34cbee
commit
5b4e2637f9
@ -170,7 +170,7 @@ upper = stringfilter(upper)
|
||||
def urlencode(value):
|
||||
"Escapes a value for use in a URL"
|
||||
import urllib
|
||||
return smart_unicode(urllib.quote(value))
|
||||
return smart_unicode(urllib.quote(smart_str(value)))
|
||||
urlencode = stringfilter(urlencode)
|
||||
|
||||
def urlize(value):
|
||||
|
@ -115,7 +115,8 @@ u'\xcb'
|
||||
u'jack%20%26%20jill'
|
||||
>>> urlencode(1)
|
||||
u'1'
|
||||
|
||||
>>> urlencode(u'S\xf8r-Tr\xf8ndelag')
|
||||
u'S%C3%B8r-Tr%C3%B8ndelag'
|
||||
|
||||
>>> urlizetrunc(u'http://short.com/', 20)
|
||||
u'<a href="http://short.com/" rel="nofollow">http://short.com/</a>'
|
||||
|
Loading…
x
Reference in New Issue
Block a user