Windows PowerShell 5.1: non-ASCII text piped into a native command arrives as `?`
Maintainers usually reply within 1 day
@akhil9tiet is already working on this.
Since Nov 26, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start by reading codex-rs/shell-command/src/powershell.rs and the prefix setup in core/src/tools/runtimes/unified_exec.rs, including the existing handling for #12496. Reproduce under Windows PowerShell 5.1 with the provided git commit -F - steps and inspect the committed message bytes. Done means the piped non-ASCII text arrives intact without a BOM across the prefix paths described in the issue.
Written by the indexing model from the issue text.
Description
What version of Codex CLI is running?
0.172.0. The code cited below reads the same on today's main.
What subscription do you have?
Free
Which model were you using?
The default model (gpt-6-luna in the 0.156.1 session logs; the problem does not depend on the model)
What platform is your computer?
Windows 11 Home 25H2 (build 26200), Windows PowerShell 5.1.26100, git 2.55.0.windows.3, no PowerShell 7
What terminal emulator and version are you using (if applicable)?
None, codex exec
What issue are you seeing?
When Codex runs a command under Windows PowerShell 5.1, any non-ASCII text that command pipes into a native program reaches the program as ?. The program gets valid ASCII and exits 0, so nothing flags it.
I hit this with agents committing through @'…'@ | git commit -F -. In three runs out of three, a Co-authored-by: Zoé Lefèvre trailer was committed as Zo? Lef?vre, and the agent didn't notice, even the run that read the commit back with git show.
In these sessions Codex ran each command as powershell.exe -Command <command> with nothing before it, so $OutputEncoding, the encoding PowerShell uses for text piped into a native program, kept 5.1's default of ASCII (about_Preference_Variables). The UTF-8 prefix in codex-rs/shell-command/src/powershell.rs:13 doesn't cover this case: it's only added on the unified exec path (core/src/tools/runtimes/unified_exec.rs:549), and it sets [Console]::OutputEncoding, which is about what Codex reads back. PowerShell 7 defaults $OutputEncoding to UTF-8, so this shows up only when Codex falls back to powershell.exe, which is every Windows install without PowerShell 7.
What steps can reproduce the bug?
On Windows without PowerShell 7, ask Codex to run these in an empty folder:
git init -q demo
cd demo
'Zoé Lefèvre' | git -c user.name=x -c [email protected] commit -q --allow-empty -F -
git log -1 --format=%B
It prints Zo? Lef?vre, and the commit holds 0x3F bytes where é and è were. In one run the message also started with a UTF-8 BOM (EF BB BF): when the console's input code page is 65001, 5.1 writes one before anything it pipes to a native program, whatever $OutputEncoding says.
What is the expected behavior?
Zoé Lefèvre, as under PowerShell 7.
Additional information
Setting both encodings before the command fixes both symptoms:
$OutputEncoding = [Console]::InputEncoding = [System.Text.UTF8Encoding]::new()
With that line under Codex on the same machine, piped text arrived byte-exact with no BOM, and setting [Console]::InputEncoding raised no error. Adding it to the prefix, inside its try { } so the constrained language case from #12496 stays quiet, would cover it wherever the prefix runs.
- Dominant language
- Rust
- Stars
- 136k
- Forks
- 21.6k
- Avg merge
- 1m
- Merged PRs (30d)
- 997
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openai/codex
-
app bug rate-limits
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug CLI connectivity
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
core-plugins: remote bundle install keeps the temp directory before a fallible rename and leaves it behind on failurePossibly taken @akhil9tiet claimed this 1 day ago. Openbug CLI skills
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openai/codex#63907 · 2 comments ·
Maintainers usually reply within 1 day
-
bug CLI
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openai/codex#63906 · 1 comment ·
Maintainers usually reply within 1 day
-
codex login status can panic when a saved API-key value contains non-ASCII textPossibly taken @akhil9tiet claimed this 2 days ago. Openauth bug CLI
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
openai/codex#63868 · 2 comments ·
Maintainers usually reply within 1 day
Similar issues
-
My Caps shows "Shared" on private Caps that were never sharedPossibly taken @AksharP5 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
CapSoftware/Cap#4569 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Document Web UIOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
parquet: reject truncated BYTE_STREAM_SPLIT numeric pages instead of silently fabricating valuesOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day