Hi Stef, Thank you for your answer pointing me to the ZnCharacter...Stream. This seems to be meant as the replacement I was looking for. I will have a closer look. Bernhard
Am 30.12.2017 um 17:35 schrieb Stephane Ducasse <stepharo.self@gmail.com>:
Hi Bernhard
Have a look at how guille started to implement File package. (Guille is actively converting all the image users of the old hierarchy but last time he losts a couple of hours because changing epicea and other users of positionable streams and sourceArray... at the same time was leading to complex situations :). But Guille told me that he learned and will come back to this.)
He is using ZnCharacterWriteStream and wrapper like ZnCrPortableWriteStream.
writeSourceCodeFrom: aStream baseName: baseName isSt: stOrCsFlag
| extension fileName outputStream | extension := stOrCsFlag ifTrue: ['.st'] ifFalse: ['.cs']. fileName := baseName, extension. fileName := FileSystem disk checkName: fileName fixErrors: true. outputStream := (File named: fileName) writeStream. (ZnCrPortableWriteStream on: (ZnCharacterWriteStream on: outputStream encoding: 'utf8')) nextPutAll: aStream contents.
outputStream close.
writeSourceCodeFrom: aStream toFileReference: aFileReference
aFileReference writeStreamDo: [ :outputStream | (ZnCrPortableWriteStream on: (ZnCharacterWriteStream on: outputStream encoding: 'utf8')) nextPutAll: aStream contents. ].
self inform: 'Filed out to: ', String cr, aFileReference basename
self inform: 'Filed out to: ', String cr, fileName.
I hope it helps.
Stef
On Sat, Dec 30, 2017 at 1:27 PM, Bernhard Pieber <bernhard@pieber.com> wrote:
I just saw that the FileStream hierarchy including MultiByteFileStream is deprecated. However, I can't find what file stream class should be used to read a UTF-8 encoded file instead. FileReference>>#readStreamDo: also uses MultiByteFileStream.
Can someone please point me to the right code?
Bernhard