morss: various encoding fixes

master
pictuga 2020-04-09 19:06:51 +02:00
parent b0f80c6d3c
commit 63a06524b7
1 changed files with 4 additions and 4 deletions

View File

@ -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')