From 8d7eb45bca68bcabec5a8da2d3440444663ddb2c Mon Sep 17 00:00:00 2001 From: zclimber <> Date: Sun, 23 Apr 2023 19:35:21 +0200 Subject: [PATCH] Fix encoding on non-pipe stdout --- legendary/cli.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/legendary/cli.py b/legendary/cli.py index 79cd730..c66a2d1 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -40,6 +40,8 @@ logger = logging.getLogger('cli') class LegendaryCLI: def __init__(self, override_config=None, api_timeout=None): + if not stdout.isatty(): + stdout.reconfigure(encoding='utf-8') self.core = LegendaryCore(override_config, timeout=api_timeout) self.logger = logging.getLogger('cli') self.logging_queue = None