← Back to PRs

#5168: Fix: force UTF-8 for Windows exec

by ManojINaik open 2026-01-31 04:29 View on GitHub →
app: web-ui agents
## Summary - wrap Windows exec commands with a UTF-8 PowerShell preamble to preserve non-ASCII paths - reuse the Windows shell helper for node host execution - add unit coverage for the PowerShell wrapper and Windows node shell args Closes #5113 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR centralizes Windows shell handling by introducing `src/infra/windows-shell.ts` (PowerShell path resolution + a UTF‑8/CP65001 preamble wrapper), switches node-host execution to use PowerShell instead of `cmd.exe`, and reuses the shared PowerShell args in `getShellConfig`. It also adds unit coverage for the wrapper and node shell argv building, plus UI work for chat image attachments (paste/drag-drop/file picker) with corresponding CSS. Main concern: the new UTF‑8 wrapper is applied for direct/PTY runs, but the docker/sandbox exec path still uses the unwrapped command, so Windows sandboxed exec may still fail on non‑ASCII paths. <h3>Confidence Score: 3/5</h3> - Reasonably safe to merge, but there is one functional gap for Windows sandbox exec. - The change is mostly additive and covered by unit tests for the new Windows shell helpers, but `runExecProcess` applies the UTF‑8 PowerShell wrapper only to direct/PTY execution while the docker/sandbox branch still uses the unwrapped command, which can leave the original Windows non‑ASCII path issue unresolved in that mode. UI additions are localized and low risk. - src/agents/bash-tools.exec.ts (Windows sandbox exec path); ui/src/ui/views/chat.ts (drag hover state robustness) <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs