John Van Praag <j...@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" <rep...@bugs.python.org> wrote: > > Ezio Melotti <ezio.melo...@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 <rep...@bugs.python.org> > <http://bugs.python.org/issue9126> > _______________________________________ > ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9126> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com