This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author markhuang3310
Recipients markhuang3310, paul.moore, steve.dower, tim.golden, zach.ware
Date 2022-03-11.16:41:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1647016865.89.0.743756251929.issue46988@roundup.psfhosted.org>
In-reply-to
Content
Env:
Windows 10
Python3.8.10 amd64

Desciption:

I try to get output from a python program with a subprocess.
The python program print a unicode character.

```
import subprocess
import sys
cmd = rf'''{sys.executable} -c "print('\u042f')"'''

print('case 1')
stdout, stderr =  subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=None).communicate()
print('case 2')
stdout, stderr =  subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE).communicate()
print(stderr)
```

The issue is that:
In case 1, I can see the "Я" (\u042f) form console.
In case 2, I try to get the output from subprocess.Popen(command).communicate()[0], the python process fail with   UnicodeEncodeError.

Expected result:
In case2, I should get stdout == b'\u042f'
History
Date User Action Args
2022-03-11 16:41:05markhuang3310setrecipients: + markhuang3310, paul.moore, tim.golden, zach.ware, steve.dower
2022-03-11 16:41:05markhuang3310setmessageid: <1647016865.89.0.743756251929.issue46988@roundup.psfhosted.org>
2022-03-11 16:41:05markhuang3310linkissue46988 messages
2022-03-11 16:41:05markhuang3310create