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

2010-07-01 Thread R. David Murray
R. David Murray added the comment: The characters are fine when you read them (that is, they decode correctly to unicode). They are only invalid when you write them to the windows terminal, which can't handle all the valid characters that are in the file. The Idle output window uses a more

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

2010-07-01 Thread John Van Praag
John Van Praag 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 (

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

2010-06-30 Thread Ezio Melotti
Ezio Melotti 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 resolut

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

2010-06-30 Thread John Van Praag
New submission from John Van Praag : The declaration errors='replace' works from within IDLE but not at the Windows command line. I am attaching a program and text file that demonstrate the problem. The error shows up at the Windows command line as follows: C:\Users\John\Documents\Python\bug_r