diff --git a/src/xopen/__init__.py b/src/xopen/__init__.py
index <HASH>..<HASH> 100644
--- a/src/xopen/__init__.py
+++ b/src/xopen/__init__.py
@@ -189,7 +189,7 @@ class PipedCompressionWriter(Closing):
             )
 
         # TODO use a context manager
-        self.outfile = open(path, mode)
+        self.outfile = open(path, mode[0] + "b")
         self.closed: bool = False
         self.name: str = str(os.fspath(path))
         self._mode: str = mode
Open output file for piping in binary mode

This avoids an EncodingWarning that was previously raised when opening the
file in text mode. For Popen, we only need something that has a fileno()
method and encoding or whether the file was opened in text mode at all is
ignored anyway.

Encoding and text mode are taken care of separately when writing into the
process.