From ab2f51260afcf30e2e4cf6437e3cfd8025da0b56 Mon Sep 17 00:00:00 2001 From: calvin Date: Wed, 27 Oct 2004 10:36:29 +0000 Subject: [PATCH] honor encoding in --file-output option git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1875 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- linkchecker | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/linkchecker b/linkchecker index 3ed8231d..411f9ded 100755 --- a/linkchecker +++ b/linkchecker @@ -428,14 +428,26 @@ if options.output: if options.fileoutput: ns = {'fileoutput': 1} for ftype in options.fileoutput: - try: - ftype, ns['filename'] = ftype.split('/', 1) - if not ns['filename']: - raise ValueError - except ValueError: - pass + # look for (optional) filename and encoding + if '/' in ftype: + ftype, suffix = ftype.split('/', 1) + if suffix: + if has_encoding(suffix): + # it was an encoding + ns['encoding'] = suffix + elif '/' in suffix: + # look for (optional) encoding + encoding, filename = suffix.split('/', 1) + if has_encoding(encoding): + ns['encoding'] = encoding + ns['filename'] = filename + else: + ns['filename'] = suffix + else: + ns['filename'] = suffix if linkcheck.Loggers.has_key(ftype): - config['fileoutput'].append(config.logger_new(ftype, **ns)) + logger = config.logger_new(ftype, **ns) + config['fileoutput'].append(logger) else: printUsage(_("Illegal argument %r for option %s") % \ (ftype, "'-F, --file-output'"))