Can't call chcp from the system method

Solution 1:

Rust strings are not NUL-terminated, so your call to system is reading whatever there is in memory after your string. I guess that's where your /rustc comes from. You need to convert your string to a CString to ensure that it is properly terminated:

system (CString::new ("chcp 65001").unwrap().as_ptr());