Closed
Description
Say I write a small program that just prints its args:
fn main() {
for arg in std::env::args_os() {
println!("{:?}", arg);
}
}
Because it uses args_os()
instead of args()
, this program can handle command line args that aren't valid unicode. However, cargo run
chokes:
$ cargo run $(printf '\xff')
invalid unicode in argument: "\u{fffd}"
I have to invoke the binary directly to test the program:
$ ./target/debug/scratch $(printf '\xff')
"./target/debug/scratch"
"\u{fffd}"
Does Cargo need to inspect the command line args at all? It not, it would be nice if it didn't require them to be utf8.