Merge pull request #887 from Hmbown/codex/fix-872-windows-utf8
fix(tui): set Windows console to UTF-8
This commit is contained in:
@@ -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"] }
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user