On Thursday 29 July 2004 11:16 am, Ned Konz wrote:
Again, the default assumption is that the String will hold text -- even though there's nothing in it yet! It seems to me that the default converter for this stream should be the Latin1TextConverter. If a particular user of a String has a need for or knowledge of a particular encoding, they can change the converter.
If there are cases where we're using files *as text* and this policy doesn't work, then they should be changed to specify their preferred encoding.
Going a bit further, we see that MultiByteBinaryOrTextStream is much too familiar with its clients:
open: fileName forWrite: writeMode
| result | result _ super open: fileName forWrite: writeMode. result ifNotNil: [ converter ifNil: [ self localName = (FileDirectory localNameFor: SmalltalkImage current sourcesName) ifTrue: [ converter _ MacRomanTextConverter new ] ifFalse: [ converter _ UTF8TextConverter new. ]. ]. self detectLineEndConvention. ]. ^result.
I *really* don't think that the stream class should be guessing what its uses are. Is there a good reason for doing this?