|
Hello,
I found a bug in the class MultiByteFileStream when Pharo(1.1-11411) running under Windows:
The following code
"(MultiByteFileStream new)
wantsLineEndConversion: true;
open: 'c: \ temp \ 1.txt' forWrite: true;
cr;
close.
"
File c: \ temp \ 1.txt contains 3 characters (cr lf lf) instead of two (cr lf).
This is due to the fact that the method MultiByteFileStream>> nextPut: There is a double conversion of Cr to CrLf.
I think this can be corrected as follows:
"
MultiByteFileStream>> nextPut: aCharacter
aCharacter isInteger
ifTrue: [^ super nextPut: aCharacter].
(wantsLineEndConversion == true and: [lineEndConvention notNil]) "# doConversion is inlined here"
ifTrue: [
aCharacter = Cr
ifTrue: [converter nextPutAll: (LineEndStrings at: # cr) toStream: self]
ifFalse: [converter nextPut: aCharacter toStream: self].
^ aCharacter].
^ Self converter nextPut: aCharacter toStream: self
"
Sincerely,
Maxim
|