diff --git a/.changeset/fix-windows-utf8-console.md b/.changeset/fix-windows-utf8-console.md new file mode 100644 index 00000000..6017281c --- /dev/null +++ b/.changeset/fix-windows-utf8-console.md @@ -0,0 +1,5 @@ +--- +"@googleworkspace/cli": patch +--- + +Force UTF-8 console output on Windows to prevent CP-1252 mojibake of non-ASCII characters diff --git a/crates/google-workspace-cli/src/main.rs b/crates/google-workspace-cli/src/main.rs index 41dcc1e1..d381e206 100644 --- a/crates/google-workspace-cli/src/main.rs +++ b/crates/google-workspace-cli/src/main.rs @@ -50,6 +50,17 @@ async fn main() { // Load .env file if present (silently ignored if missing) let _ = dotenvy::dotenv(); + // Windows: force UTF-8 console output to prevent CP-1252 mojibake of non-ASCII characters + #[cfg(target_os = "windows")] + { + extern "system" { + fn SetConsoleOutputCP(wCodePageID: u32) -> i32; + } + unsafe { + SetConsoleOutputCP(65001); + } + } + // Initialize structured logging (no-op if env vars are unset) logging::init_logging();