diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index bcfd3449f..6131a46df 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -381,7 +381,7 @@ class FDCaptureBinary: self.targetfd_save = os.dup(targetfd) if targetfd == 0: - self.tmpfile = open(os.devnull) + self.tmpfile = open(os.devnull, encoding="utf-8") self.syscapture = SysCapture(targetfd) else: self.tmpfile = EncodedFile(