diff -r dbe69f54b09c Lib/subprocess.py --- a/Lib/subprocess.py Wed Jun 01 13:54:33 2016 -0700 +++ b/Lib/subprocess.py Thu Jun 02 19:44:59 2016 +0300 @@ -925,16 +925,22 @@ if p2cwrite != -1: self.stdin = io.open(p2cwrite, 'wb', bufsize) if universal_newlines: + enc = os.device_encoding(0) if (stdin == PIPE) else None self.stdin = io.TextIOWrapper(self.stdin, write_through=True, + encoding=enc, line_buffering=(bufsize == 1)) if c2pread != -1: self.stdout = io.open(c2pread, 'rb', bufsize) if universal_newlines: - self.stdout = io.TextIOWrapper(self.stdout) + enc = os.device_encoding(1) if (stdout == PIPE) else None + self.stdout = io.TextIOWrapper(self.stdout, + encoding=enc) if errread != -1: self.stderr = io.open(errread, 'rb', bufsize) if universal_newlines: - self.stderr = io.TextIOWrapper(self.stderr) + enc = os.device_encoding(2) if (stderr == PIPE) else None + self.stderr = io.TextIOWrapper(self.stderr, + encoding=enc) self._closed_child_pipe_fds = False try: