--- a/WriteStream.st Wed Aug 21 11:51:30 2013 +0100
+++ b/WriteStream.st Fri Aug 23 11:44:50 2013 +0100
@@ -548,9 +548,15 @@
nextPutAllUnicode:aString
"normal streams can not handle multi-byte characters, so convert them to utf8"
- (collection isString and:[collection isWideString not]) ifTrue:[
- aString do:[:eachCharacter|
- self nextPutUtf8:eachCharacter.
+ "this code is not perfect if you use both #nextPutAll: and #nextPutAllUnicode:
+ with the same stream, since 8-bit characters (with the highest bits set)
+ are not stored as UTF, so we get some inconsistent string"
+
+ collection isString ifTrue:[
+ collection bitsPerCharacter == 16 ifTrue:[
+ self nextPutAllUtf16:aString.
+ ] ifFalse:[
+ self nextPutAllUtf8:aString.
].
] ifFalse:[
self nextPutAll:aString
@@ -639,8 +645,16 @@
nextPutUnicode:aCharacter
"normal streams can not handle multi-byte characters, so convert them to utf8"
- (collection isString and:[collection isWideString not]) ifTrue:[
- self nextPutUtf8:aCharacter.
+ "this code is not perfect if you use both #nextPut: and #nextPutUnicode:
+ with the same stream, since 8-bit characters (with the highest bits set)
+ are not stored as UTF, so we get some inconsistent string"
+
+ collection isString ifTrue:[
+ collection bitsPerCharacter == 16 ifTrue:[
+ self nextPutUtf16:aCharacter.
+ ] ifFalse:[
+ self nextPutUtf8:aCharacter.
+ ].
] ifFalse:[
self nextPut:aCharacter.
].
@@ -649,10 +663,10 @@
!WriteStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/WriteStream.st,v 1.80 2013-08-10 11:30:31 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/WriteStream.st,v 1.82 2013-08-20 13:45:48 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/WriteStream.st,v 1.80 2013-08-10 11:30:31 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/WriteStream.st,v 1.82 2013-08-20 13:45:48 stefan Exp $'
! !