conradkleinespel / rpassword

Cross platform Rust library to read a password in the terminal (Linux, BSD, OSX, Windows, WASM).
Apache License 2.0
243 stars 38 forks source link

Unable to use unicode for passwords on Windows #82

Open vladmikhalin opened 1 year ago

vladmikhalin commented 1 year ago

Trying to use the library (7.2.0) but getting errors or question marks instead of entered characters when using Unicode on Windows.

Example code that reproduces this:

use std::io::Write;

fn main() {
    // copy these strings and enter them as password
    println!("éëęėεeeη"); // Error: stream did not contain valid UTF-8
    println!("äáàâăåαā"); // Error: stream did not contain valid UTF-8
    println!("её");       // "??"
    print!("password: ");
    std::io::stdout().flush().unwrap();
    let password = rpassword::read_password().unwrap();
    println!("{}", password);
}
conradkleinespel commented 1 year ago

Hello ! Thanks for reporting. This project has few maintainers and our time is limited so you'll most likely have to find a fix and submit a PR with test case.