diff --git a/crates/tui/Cargo.toml b/crates/tui/Cargo.toml index 7975db36..26fb4236 100644 --- a/crates/tui/Cargo.toml +++ b/crates/tui/Cargo.toml @@ -81,4 +81,4 @@ libc = "0.2" libc = "0.2" [target.'cfg(target_os = "windows")'.dependencies] -windows = { version = "0.60", features = ["Win32_Foundation", "Win32_UI_WindowsAndMessaging", "Win32_System_Diagnostics_Debug"] } +windows = { version = "0.60", features = ["Win32_Foundation", "Win32_System_Console", "Win32_UI_WindowsAndMessaging", "Win32_System_Diagnostics_Debug"] } diff --git a/crates/tui/src/main.rs b/crates/tui/src/main.rs index 3579c2db..e8a225f8 100644 --- a/crates/tui/src/main.rs +++ b/crates/tui/src/main.rs @@ -78,6 +78,20 @@ use crate::models::{ContentBlock, Message, MessageRequest, SystemPrompt}; use crate::session_manager::{SessionManager, create_saved_session}; use crate::tui::history::{summarize_tool_args, summarize_tool_output}; +#[cfg(windows)] +fn configure_windows_console_utf8() { + use windows::Win32::System::Console::{SetConsoleCP, SetConsoleOutputCP}; + + const CP_UTF8: u32 = 65001; + unsafe { + let _ = SetConsoleCP(CP_UTF8); + let _ = SetConsoleOutputCP(CP_UTF8); + } +} + +#[cfg(not(windows))] +fn configure_windows_console_utf8() {} + #[derive(Parser, Debug)] #[command( name = "deepseek", @@ -543,6 +557,8 @@ enum SandboxCommand { #[tokio::main] async fn main() -> Result<()> { + configure_windows_console_utf8(); + // Set up process panic hook before anything else — writes crash dumps // to ~/.deepseek/crashes/ even if the panic happens before tokio is up, // and restores the terminal so a panicked TUI doesn't leave the user's