[issue9126] errors='replace' does not work at Windows command line

John Van Praag report at bugs.python.org
Thu Jul 1 15:54:22 CEST 2010


John Van Praag <john at jvp247.com> added the comment:

According to the documentation of the open function:

errors is an optional string that specifies how encoding and decoding
errors are to be handled–this cannot be used in binary mode. Pass
'strict' to raise a ValueError exception if there is an encoding error
(the default of None has the same effect), or pass 'ignore' to ignore
errors. (Note that ignoring encoding errors can lead to data loss.)
'replace' causes a replacement marker (such as '?') to be inserted where
there is malformed data. 

If a replacement marker such as '?' were replacing the bad characters,
the print function would not have a problem. The open function is not
working as described in the documentation.

On Wed, 30 Jun 2010 22:29 +0000, "Ezio Melotti" <report at bugs.python.org>
wrote:
> 
> Ezio Melotti <ezio.melotti at gmail.com> added the comment:
> 
> The problem is not in the reading part, but in the print().
> Since the default encoding of your terminal is cp437 and cp437 is not
> able to encode the "bad character" (U+2019 RIGHT SINGLE QUOTATION MARK),
> an error is raised.
> 
> ----------
> nosy: +ezio.melotti
> resolution:  -> invalid
> stage:  -> committed/rejected
> status: open -> closed
> type:  -> behavior
> 
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue9126>
> _______________________________________
>

----------

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


More information about the Python-bugs-list mailing list