Fix downloading of news that has non-English characters in its title on windows. Fixes #3005 (RSS Fetching from zaobao.com still fail)

This commit is contained in:
Kovid Goyal 2009-08-03 13:57:42 -06:00
parent 31d46786e5
commit f3635ab09c
2 changed files with 6 additions and 2 deletions

View File

@ -51,6 +51,7 @@ class Plumber(object):
:param input: Path to input file.
:param output: Path to output file/directory
'''
self.original_input_arg = input
self.input = os.path.abspath(input)
self.output = os.path.abspath(output)
self.log = log
@ -636,6 +637,8 @@ OptionRecommendation(name='language',
tdir = PersistentTemporaryDirectory('_plumber')
stream = self.input if self.input_fmt == 'recipe' else \
open(self.input, 'rb')
if self.input_fmt == 'recipe':
self.opts.original_recipe_input_arg = self.original_input_arg
if hasattr(self.opts, 'lrf') and self.output_plugin.file_type == 'lrf':
self.opts.lrf = True

View File

@ -48,11 +48,12 @@ class RecipeInput(InputFormatPlugin):
if os.access(recipe_or_file, os.R_OK):
recipe = compile_recipe(open(recipe_or_file, 'rb').read())
else:
title = os.path.basename(recipe_or_file).rpartition('.')[0]
title = getattr(opts, 'original_recipe_input_arg', recipe_or_file)
title = os.path.basename(title).rpartition('.')[0]
recipe = get_builtin_recipe(title)
if recipe is None:
raise ValueError('%s is not a valid recipe file or builtin recipe' %
raise ValueError('%r is not a valid recipe file or builtin recipe' %
recipe_or_file)
ro = recipe(opts, log, self.report_progress)