From 5ac8c3a862d810f5a7f4515839dbccb43176f49c Mon Sep 17 00:00:00 2001 From: idziubenko Date: Fri, 10 Dec 2021 18:00:10 +0300 Subject: [PATCH] FEAT: added utf-16 fallback for process output --- pym/calculate/lib/utils/files.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pym/calculate/lib/utils/files.py b/pym/calculate/lib/utils/files.py index 9288db5..a423f8d 100644 --- a/pym/calculate/lib/utils/files.py +++ b/pym/calculate/lib/utils/files.py @@ -283,7 +283,10 @@ class process(StdoutableProcess): else: for line in self.readByLine(): pass - return self.cacheresult.decode(encoding="UTF-8") + try: + return self.cacheresult.decode(encoding="UTF-8") + except UnicodeDecodeError as e: + return self.cacheresult.decode(encoding="UTF-16") except KeyboardInterrupt: self.kill() raise KeyboardInterrupt