Hi Nicolai, The FileSystem API is a bit inconsistent, yes.
This is how you can use it: (FileLocator temp / 'foo.txt') writeStreamDo: [ :out | out binary. (ZnCharacterWriteStream on: out encoding: #utf8) << 'élève' ]. (FileLocator temp / 'foo.txt') readStreamDo: [ :in | in binary. ZnCharacterReadStream on: in encoding: #utf8) upToEnd ]. (FileLocator temp / 'foo.txt') binaryReadStreamDo: [ :in | (ZnCharacterReadStream on: in encoding: #utf8) upToEnd ]. There is no #binaryWriteStreamDo: The API around File is more correct, IMHO. Does this help ? What exactly is your question ? Sven > On 4 Feb 2017, at 12:09, Nicolai Hess <nicolaih...@gmail.com> wrote: > > Hi > How can I specify the character encoding when opening a readStream on a > FileRerefence. > > I found this, that works: > > | readStream fileContent | > readStream := (File named: aFileName) openForRead. > fileContent := ZnCharacterReadStream on: readStream encoding: encoding. > fileContent upToEnd asString. > > But if I try to do the same with a readStream from a FileReference > > | readStream fileContent | > readStream := aFileName asFileReference readStream. > fileContent := ZnCharacterReadStream on: readStream encoding: encoding. > fileContent upToEnd asString. > > I get an error SmallInteger DNU #asciiValue, > > this is because, in the first method, we create a binary filestream, and if we > use readStream from a FileReference, the stream is a MultibyteFileStream. > > How can I us ZnEncoder for a readstream from a FileReference? > > (and is it on purpose that both readStream method (openForRead/readStream) > return different kinds of binary streams?) > > > nicolai