From 2b0dd3b5dd6425f442acefa959efd9f27b132d77 Mon Sep 17 00:00:00 2001 From: Jeppe Pihl Date: Mon, 28 Aug 2023 12:00:35 +0200 Subject: [PATCH] allow non-utf-8 chars --- NEWS.rst | 3 ++- src/dummynet/process_monitor.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS.rst b/NEWS.rst index 6e674f1..ae50414 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -5,7 +5,8 @@ every change, see the Git log. Latest ------ -* tbd +* Patch: Allow processes to output non-UTF-8 characters to stdout and stderr by + replacing with '?'. 2.4.0 ----- diff --git a/src/dummynet/process_monitor.py b/src/dummynet/process_monitor.py index 08d3c71..2fbad89 100644 --- a/src/dummynet/process_monitor.py +++ b/src/dummynet/process_monitor.py @@ -52,7 +52,7 @@ def read_fd(self, fd): self.log.debug(f"Poller: read {len(data)} bytes from fd {fd}") # Call the callback - self.fds[fd](data.decode("utf-8")) + self.fds[fd](data.decode(encoding="utf-8", errors="replace")) def poll(self, timeout): fds = self.poller.poll(timeout)