[issue9511] CharacterEncoderError when reading from sys.stdin from piped input in cmd.exe

Peter Boström report at bugs.python.org
Wed Aug 4 15:58:52 CEST 2010


New submission from Peter Boström <peterbostrom at gmail.com>:

When reading from piped stdin, python has trouble decoding some special characters.

To reproduce, run the following command from cmd.exe:

  echo ü | C:\Python31\python.exe pycat.py

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 0: character maps to <undefined>

I've been able to reproduce this in a German version of Windows Vista, which I use at work. I detected this error when trying to pipe (and parse) output from the ping command, which contains non-simple characters. If I don't pipe and just type into the program, it works just fine, even with "strange" characters.

----------
components: Windows
files: pycat.py
messages: 112810
nosy: pbos
priority: normal
severity: normal
status: open
title: CharacterEncoderError when reading from sys.stdin from piped input in cmd.exe
versions: Python 3.1
Added file: http://bugs.python.org/file18385/pycat.py

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


More information about the Python-bugs-list mailing list