diff --git a/Cargo.toml b/Cargo.toml index b1ef0fd..ff35371 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,4 +19,4 @@ libc = "0.2" windows-sys = { version = "0.52", features = ["Win32_Foundation", "Win32_System_Console", "Win32_Storage_FileSystem", "Win32_Security", "Win32_System_SystemServices"] } [dependencies] -rtoolbox = { path = "../rtoolbox", version = "0.0" } +rtoolbox = "0.0.2" diff --git a/src/lib.rs b/src/lib.rs index 5063a48..607edb4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -258,6 +258,13 @@ pub fn prompt_password_from_bufread( /// Prompts on the TTY and then reads a password from TTY pub fn prompt_password(prompt: impl ToString) -> std::io::Result { + #[cfg(target_family = "windows")] + { + use windows_sys::Win32::System::Console::SetConsoleOutputCP; + unsafe { + SetConsoleOutputCP(65001); // 65001 is UTF-8 + }; + } print_tty(prompt.to_string().as_str()).and_then(|_| read_password()) }