aboutsummaryrefslogtreecommitdiffstats
path: root/MgaRepo/commands
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <proyvind@moondrake.org>2016-05-31 23:15:21 +0200
committerPer Øyvind Karlsen <proyvind@moondrake.org>2016-05-31 23:15:21 +0200
commit071ff4727cbb8461fdcb826aeb5d67ea462ebfeb (patch)
treec471094ac83d894e46053b8fdd50da5d844a96bf /MgaRepo/commands
parent642907990e73b387d75a6c1df13b9f70648e24ea (diff)
downloadmgarepo-071ff4727cbb8461fdcb826aeb5d67ea462ebfeb.tar
mgarepo-071ff4727cbb8461fdcb826aeb5d67ea462ebfeb.tar.gz
mgarepo-071ff4727cbb8461fdcb826aeb5d67ea462ebfeb.tar.bz2
mgarepo-071ff4727cbb8461fdcb826aeb5d67ea462ebfeb.tar.xz
mgarepo-071ff4727cbb8461fdcb826aeb5d67ea462ebfeb.zip
fix issue with utf-8 encodig for rpmlog when utf-8 locale isn't set
Diffstat (limited to 'MgaRepo/commands')
-rw-r--r--MgaRepo/commands/rpmlog.py3
1 files changed, 3 insertions, 0 deletions
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():