[issue21927] BOM appears in stdin when using Powershell

Jason R. Coombs report at bugs.python.org
Wed Jul 16 13:43:31 CEST 2014


Jason R. Coombs added the comment:

Here I use the british pound symbol to attempt to answer that question. I've disabled the environment variable PYTHONIOENCODING and not set any code page or loaded any other Powershell profile settings.

PS C:\Users\jaraco> echo £
£
PS C:\Users\jaraco> chcp
Active code page: 437
PS C:\Users\jaraco> echo £ | py -3 -c "import sys; print(repr(sys.stdin.read()))"
'?\n'
PS C:\Users\jaraco> chcp 65001
Active code page: 65001
PS C:\Users\jaraco> echo £ | py -3 -c "import sys; print(repr(sys.stdin.read()))"
'?\n'
PS C:\Users\jaraco> echo £ | py -3 -c "import sys; print(repr(sys.stdin.buffer.read()))"
b'?\r\n'

Curiously, it appears as if powershell is actually receiving a question mark from the pipe.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21927>
_______________________________________


More information about the Python-bugs-list mailing list