Message265785
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? |
|
Date |
User |
Action |
Args |
2016-05-17 22:43:52 | martin.panter | set | recipients:
+ martin.panter, amaury.forgeotdarc, ncoghlan, pitrou, vstinner, mark, eric.araujo, segfaulthunter, Arfrever, r.david.murray, srid, mightyiam, chris.jerdonek, berwin22 |
2016-05-17 22:43:51 | martin.panter | set | messageid: <1463525031.96.0.571691703392.issue6135@psf.upfronthosting.co.za> |
2016-05-17 22:43:51 | martin.panter | link | issue6135 messages |
2016-05-17 22:43:51 | martin.panter | create | |
|