OsString and stdin/stdout


#1

Is it possible and does it even make sense to read an OsString from stdin or Output::stdout or write to stdout in a platform-neutral manner?
I have a vague recollection that while the Windows console supports Unicode it’s still tied to DOS codepages a lot so we might read some unexpected garbage…


#2

On Windows we actually plan to expose two raw versions of stdout/stdin. One which read/writes UCS-2 using OsString when you are attached to a console using ReadConsoleW and WriteConsoleW and the other which reads/writes arbitrary [u8] when you’re attached to a pipe.

See https://github.com/rust-lang/rfcs/pull/899 for more details.


#3

Thanks for the link. One of the reasons for my question is this case:
You’re making a command line utility that takes some paths from a pipe. Would there be a general way to get Paths from stdin without dealing with platform specific quirks?