News download: Handle URLs that have commas and non ascii characters correctly

This commit is contained in:
Kovid Goyal 2010-01-09 14:24:48 -07:00
parent 5b4b130468
commit e9254aa75a
2 changed files with 3 additions and 3 deletions

View File

@ -55,7 +55,7 @@ class TXTInput(InputFormatPlugin):
html = convert_markdown(txt, disable_toc=options.markdown_disable_toc)
except RuntimeError:
raise ValueError('This txt file has malformed markup, it cannot be'
'converted by calibre. See http://daringfireball.net/projects/markdown/syntax')
' converted by calibre. See http://daringfireball.net/projects/markdown/syntax')
else:
html = convert_basic(txt)

View File

@ -191,9 +191,9 @@ class RecursiveFetcher(object):
if isinstance(url, unicode):
url = url.encode('utf-8')
# Not sure is this is really needed as I think mechanize
# handles quoting automatically, but leaving it in
# handles quoting automatically, but leaving it
# in case it breaks something
if re.search(r'\s+|,', url) is not None:
if re.search(r'\s+', url) is not None:
purl = list(urlparse.urlparse(url))
for i in range(2, 6):
purl[i] = quote(purl[i])