Thanks sven

Indeed this would be good. Right now we will continue to fix the problems we 
are looking (event sensor, canvas….) at but this is good that people work on 
other parts of the system.

Stef

>>> <rant>Notice how f*cked up TextConverters are: when given a binary stream, 
>>> their natural input one would think, they just don't do any 
>>> conversion!</rant>
>> 
>> Isn't that obvious? In a time where there was text or binary and your 
>> biggest problem was line ending conversion it is normal to do not any 
>> processing on a binary stream. It is its definition. The world has changed 
>> since then and since we have encodings there is no such thing as a 
>> text/ascii stream anymore. I think we have to slowly convert those things to 
>> modern stuff. How hard that is? Look at Grease it is a piece of modern 
>> software but still encodes string -> string. There are always caveats not to 
>> ignore.
> 
> Right!
> 
> In the very latest Zn I added ZnCharacterReadStream and 
> ZnCharacterWriteStream but I did not yet integrate/use them. These add 
> character decoding and encoding to binary streams, here are some tests that 
> show how to use them:
> 
> testSimpleUTF8WriteStream
>       | string bytes stream |
>       string := 'élève en Français'.
>       bytes := ZnUTF8Encoder new encodeString: string.
>       stream := (ZnCharacterWriteStream on: #[] writeStream).
>       stream nextPutAll: string.
>       self 
>               assert: stream wrappedStream contents
>               equals: bytes
> 
> testSimpleUTF8ReadStream
>       | string bytes |
>       string := 'élève en Français'.
>       bytes := ZnUTF8Encoder new encodeString: string.
>       self 
>               assert: (ZnCharacterReadStream on: bytes readStream) upToEnd
>               equals: string
> 
> I think these could be useful in other places (FS) as well and help in 
> getting rid of some old stuff.
> Mind you, these are currently still only experiments.
> 
> Sven
> 
> 
> --
> Sven Van Caekenberghe
> http://stfx.eu
> Smalltalk is the Red Pill
> 
> 
> 
> 
> 


Reply via email to