Martin Panter added the comment:

This seems like a request for extra feature(s), rather than a bug report.

FWIW I agree with Victor’s hesitation in 
<https://bugs.python.org/issue6135#msg123024>. I doubt it is worth adding 
special support to have multiple pipes that all use text mode 
(universal_newlines=True) but with different encoding settings. If you really 
want this, just add an external TextIOWrapper, or string encoding:

process = Popen(command, stdin=PIPE, stdout=PIPE, ...)

# Manually wrap with TextIOWrapper. Probably risks deadlocking in the general 
case, due to buffering, so this is a bad idea IMO.
input_writer = io.TextIOWrapper(process.stdin, "iso-8859-1")
output_reader = io.TextIOWrapper(process.stdout, "utf-8")

# Better: use communicate(), or a custom select() loop or similar:
input_string = input_string.encode("iso-8859-1")
[output_string, _] = process.communicate(input_string)
output_string = output_string.decode("utf-8")

Also I’m not enthusiastic about adding encoding etc parameters for a single 
PIPE scenario. What is wrong with leaving it in binary mode in the Popen call, 
and encoding, decoding, or using TextIOWrapper as a separate step?

----------
type: behavior -> enhancement
versions: +Python 3.6 -Python 2.7, Python 3.2, Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6135>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to