News download: Correctly handle URLs with non ASCII characters in them

This commit is contained in:
Kovid Goyal 2009-12-24 12:26:13 -07:00
parent b0eb97c60a
commit 6ae6e2ffed

View File

@ -188,7 +188,8 @@ class RecursiveFetcher(object):
delta = time.time() - self.last_fetch_at
if delta < self.delay:
time.sleep(delta)
if re.search(r'\s+|,', url) is not None:
if isinstance(url, unicode):
url = url.encode('utf-8')
purl = list(urlparse.urlparse(url))
for i in range(2, 6):
purl[i] = quote(purl[i])