On Mon, Jul 23, 2018 at 07:38:16PM +0100, Denis Kudriashov wrote: > Hi. > > I wonder does not stdout and stdin are always about text input/output?
No. Consider the case of reading and writing serialized objects on stdin and stdout, possibly between two images sending serialized objects to one another. > I never saw examples when somebody explicitly write raw bytes into these > streams. http://wiki.squeak.org/squeak/6176 I have not checked recently, but it should still work on Pharo with Fuel serialization. > > 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? > You are probably right that this is the best default, since it would be the most common case. Dave > > 2018-07-23 19:19 GMT+01:00 Alistair Grant <akgrant0...@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 <s...@stfx.eu> wrote: > > > > > > > > > > > > > On 23 Jul 2018, at 11:13, Ben Coman <b...@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 > > > >