[minor] Unicode issue in quote url

This commit is contained in:
Anand Doshi 2014-09-26 18:04:18 +05:30
parent e1089d1f2d
commit 08d94920f6

View file

@ -580,7 +580,7 @@ def expand_relative_urls(html):
def quote_urls(html):
def _quote_url(match):
groups = list(match.groups())
groups[2] = urllib.quote(groups[2], safe="~@#$&()*!+=:;,.?/'")
groups[2] = urllib.quote(groups[2].encode("utf-8"), safe=b"~@#$&()*!+=:;,.?/'").decode("utf-8")
return "".join(groups)
return re.sub('(href|src){1}([\s]*=[\s]*[\'"]?)((?:http)[^\'">]+)([\'"]?)',
_quote_url, html)