From 40eaf8435414c6f0a3c7968942b90b5fa85f4d44 Mon Sep 17 00:00:00 2001 From: MichaƂ Klichowicz Date: Sat, 13 Apr 2024 13:17:56 +0200 Subject: In a console-less setup, e.g. GUI, revert to any sane log encoding Fixes #55 --- jfr_playoff/dto.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'jfr_playoff/dto.py') diff --git a/jfr_playoff/dto.py b/jfr_playoff/dto.py index 44fe8cb..605493a 100644 --- a/jfr_playoff/dto.py +++ b/jfr_playoff/dto.py @@ -1,6 +1,9 @@ from math import ceil, floor import sys +from jfr_playoff.logger import log_encoding + + def coalesce(*arg): for el in arg: if el is not None: @@ -39,7 +42,7 @@ class Team(object): return u'%s (%.1f)' % (coalesce(self.name, ''), self.score) def __repr__(self): - return unicode(self).encode(sys.stdin.encoding) + return unicode(self).encode(log_encoding()) class Match(object): @@ -61,7 +64,7 @@ class Match(object): self.id, coalesce(self.link, ''), [unicode(team) for team in self.teams], u'finished' if self.running < 0 else ( u'%d boards' % self.running)) - ).encode(sys.stdin.encoding) + ).encode(log_encoding()) class Phase(object): -- cgit v1.2.3