From 63a06524b7cd841cdc053325fd55142d57b2eda6 Mon Sep 17 00:00:00 2001 From: pictuga Date: Thu, 9 Apr 2020 19:06:51 +0200 Subject: [PATCH] morss: various encoding fixes --- morss/morss.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/morss/morss.py b/morss/morss.py index 06694f1..c80c84a 100644 --- a/morss/morss.py +++ b/morss/morss.py @@ -471,10 +471,10 @@ def FeedFormat(rss, options, encoding='utf-8'): else: if options.indent: - return rss.torss(xml_declaration=True, encoding=encoding, pretty_print=True) + return rss.torss(xml_declaration=(not encoding == 'unicode'), encoding=encoding, pretty_print=True) else: - return rss.torss(xml_declaration=True, encoding=encoding) + return rss.torss(xml_declaration=(not encoding == 'unicode'), encoding=encoding) def process(url, cache=None, options=None): @@ -724,10 +724,10 @@ def cli_app(): url = UrlFix(url) rss = FeedFetch(url, options) rss = FeedGather(rss, url, options) - out = FeedFormat(rss, options) + out = FeedFormat(rss, options, 'unicode') if not options.silent: - print(out.decode('utf-8', 'replace') if isinstance(out, bytes) else out) + print(out) log('done')