From: D-Man <ds...@ri...> - 2001-03-09 16:10:14
|
On Fri, Mar 09, 2001 at 08:17:02AM +0000, Finn Bock wrote: | | Incorrect. It is Jython that does this mangling. The issue basicly is: | should a read from a file into a unicode String read the data as binary | (and always set the top 8 bit to zero) or as text by passing the data | through the default encoding. | | Without the 'b' flag, Jython is reading and writing the data as if using | a Reader/Writer class. When you use the 'b' flag it uses a | InputStream/OutputStream. | | This overloading of the 'b' flag (the flag also controls the platform | dependent newline translation) is not a good thing, but it was the best | I could come up with. Normally is works as expected and I think that | also goes for John's case. Perhaps it would better for Jython to match CPython and C with respect to the open() function, but require people to construct the other Reader/Writer objects using the Java classes? I am curious as to why the "format string" style of argument was chosen instead of an enum style (for CPython, Jython and C). I think that it would be simpler for the libary implementer and easier on the client to use an enum type, or even different classes similar to Java (but easier to get one that does what you want ;-)). Thanks, -D |