Hello everyone,

I thing, there is a bug in WriteStream, but i'm not sure.
When I look at this code, I guess aString is not always a String, and yesterday, I had a Text send to this method, which raised a DNU error.

(in blue is what I have change to make it work in my case)

WriteStream>>nextChunkPut: aString
"Append the argument, aString, to the receiver, doubling embedded terminators."
 
| i remainder terminator | 
terminator := $!.
remainder := aString asString.
[(i := remainder indexOf: terminator) = 0] whileFalse:
[self nextPutAll: (remainder copyFrom: 1 to: i).
self nextPut: terminator.  "double imbedded terminators"
remainder := remainder copyFrom: i+1 to: remainder size].
self nextPutAll: remainder. 
aString asString includesUnifiedCharacter ifTrue: [
self nextPut: terminator.
self nextPutAll: ']lang['.
aString asString writeLeadingCharRunsOn: self.
].
self nextPut: terminator.



Is that a bug ?


Regards,

Ben