diff options
Diffstat (limited to 'python/qemu/machine/machine.py')
-rw-r--r-- | python/qemu/machine/machine.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index a7081b1845..34131884a5 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -19,6 +19,7 @@ which provides facilities for managing the lifetime of a QEMU VM. import errno from itertools import chain +import locale import logging import os import shutil @@ -290,8 +291,12 @@ class QEMUMachine: return self._subp.pid def _load_io_log(self) -> None: + # Assume that the output encoding of QEMU's terminal output is + # defined by our locale. If indeterminate, allow open() to fall + # back to the platform default. + _, encoding = locale.getlocale() if self._qemu_log_path is not None: - with open(self._qemu_log_path, "r") as iolog: + with open(self._qemu_log_path, "r", encoding=encoding) as iolog: self._iolog = iolog.read() @property |