This commit is contained in:
Kovid Goyal 2013-04-22 18:44:02 +05:30
parent 6dbd826c51
commit c0d5f59d5b

View File

@ -361,7 +361,9 @@ URL_SAFE = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ'
URL_UNSAFE = [ASCII_CHARS - URL_SAFE, UNIBYTE_CHARS - URL_SAFE] URL_UNSAFE = [ASCII_CHARS - URL_SAFE, UNIBYTE_CHARS - URL_SAFE]
def urlquote(href): def urlquote(href):
"""Quote URL-unsafe characters, allowing IRI-safe characters.""" """ Quote URL-unsafe characters, allowing IRI-safe characters.
That is, this function returns valid IRIs not valid URIs. In particular,
IRIs can contain non-ascii characters. """
result = [] result = []
unsafe = 0 if isinstance(href, unicode) else 1 unsafe = 0 if isinstance(href, unicode) else 1
unsafe = URL_UNSAFE[unsafe] unsafe = URL_UNSAFE[unsafe]