Hi. I wonder does not stdout and stdin are always about text input/output? I never saw examples when somebody explicitly write raw bytes into these streams. If I am right then it is better to introduce binaryStdout and binaryStdin messages. And make stdout and stdin use most common encoding by default. How it is done in Java? 2018-07-23 19:19 GMT+01:00 Alistair Grant <akgrant0710@gmail.com>:
Hi Pavel & Sven,
Thanks for writing this, it is a great quick reference.
On Mon, 23 Jul 2018 at 12:08, Sven Van Caekenberghe <sven@stfx.eu> wrote:
On 23 Jul 2018, at 11:13, Ben Coman <btc@openinworld.com> wrote:
I like all the new code examples until "Write a UTF-8 text to STDOUT" and I wonder "Stdio stdout writeStreamDo: [ :stream | stream nextPutAll: 'a â b' ]" would better fit the pattern of the other new code. (presuming "Stdio stdout" returns a FileReference, oherwise maybe "Stdio stdoutRef" or "Stdio stdout asFileReference")
Stdio stdout and friends just return a binary stream, hence they need
wrapping for encoding.
Maybe
Stdio stdoutAsText
might be an idea, but this is so uncommon that I am not sure this is a
good idea.
I've written this code enough times that I'd like to see it included. :-)
Maybe
Stdout utf8Stdout
(following the pattern of ByteArray>>utf8Decoded, String>>utf8Encoded)
?
Thanks again, Alistair