Incorrect Cyrillic rendering in Codex Agent on Windows due to PowerShell 5.1 default ANSI encoding

Description:
When using Codex Agent on Windows (VS Code / Cursor / Windsurf), files containing Cyrillic comments are displayed incorrectly (garbled characters). The agent appears to invoke powershell.exe by default, which uses ANSI instead of UTF-8.

Expected behavior:

  • Files with UTF-8 encoding (with or without BOM) should display correctly.

  • Ideally, the agent should:

    • Use PowerShell 7 (pwsh) by default (UTF-8 is the default there), or

    • Explicitly pass -Encoding UTF8 when reading/writing files, or

    • Provide a setting to override the shell used for Agent actions.

Steps to reproduce:

  1. Open a UTF-8 encoded JavaScript/TypeScript file with Cyrillic comments in VS Code on Windows.

  2. Run Codex Agent and ask it to show the first 10 lines.

  3. Cyrillic characters are replaced with question marks / invalid symbols.

Notes:

  • This does not happen in the built-in chat (Cursor/Windsurf) because text is read directly from the editor buffer.

  • Only the Agent (when reading/writing via PowerShell) shows corrupted characters.

  • Using Node.js or pwsh with -Encoding UTF8 works correctly.

Environment:

  • Windows 11 (latest build, exact version unknown but fully up to date)

  • VS Code 1.103.2

  • Codex extension 0.4.0

  • Node.js 22.17

  • PowerShell 7.5.2 installed, but Agent still defaults to legacy Windows PowerShell 5.1

  • Hardware: standard desktop PC

1 Like

Same problem, all my files get destroyed with incorrect encoding usage of codex for local edit on Windows

1 Like

Same problem here. It seems that it happens not right off the bat, but after a while.

1 Like