From 071ff4727cbb8461fdcb826aeb5d67ea462ebfeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Tue, 31 May 2016 23:15:21 +0200 Subject: fix issue with utf-8 encodig for rpmlog when utf-8 locale isn't set --- MgaRepo/commands/rpmlog.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'MgaRepo') diff --git a/MgaRepo/commands/rpmlog.py b/MgaRepo/commands/rpmlog.py index 88dfc4b..2b62925 100644 --- a/MgaRepo/commands/rpmlog.py +++ b/MgaRepo/commands/rpmlog.py @@ -60,6 +60,9 @@ def rpmlog(pkgdirurl, revision, size, template, oldlog, usespec, sort): spec, another = split_spec_changelog(StringIO(rawspec)) newlog = get_changelog(pkgdirurl, another=another, rev=revision, size=size, sort=sort, template=template, oldlog=oldlog) + # make sure stdout support unicode, otherwise it'll croak when encountered + if not "UTF-8" in sys.stdout.encoding: + sys.stdout = open(sys.stdout.fileno(), mode="w", encoding="UTF-8") sys.stdout.writelines(newlog) def main(): -- cgit v1.2.1