Windows PowerShell 5.1: non-ASCII text piped into a native command arrives as `?`
I maintainer di solito rispondono entro 1 giorno
@akhil9tiet ci sta già lavorando.
Dal 26/11/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
Direzione di ricerca
Inizia leggendo codex-rs/shell-command/src/powershell.rs e la configurazione del prefisso in core/src/tools/runtimes/unified_exec.rs, inclusa la gestione esistente per #12496. Riproduci il problema in Windows PowerShell 5.1 con i passaggi forniti per git commit -F - e ispeziona i byte del messaggio di commit salvato. Il lavoro è completato quando il testo non ASCII passato tramite pipe arriva intatto e senza BOM attraverso i percorsi del prefisso descritti nell’issue.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Rust
- Stelle
- 136k
- Fork
- 21.6k
- Merge medio
- 1m
- PR unite (30g)
- 997
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openai/codex
-
app bug rate-limits
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug CLI connectivity
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
core-plugins: remote bundle install keeps the temp directory before a fallible rename and leaves it behind on failureForse già presa @akhil9tiet l’ha presa 1 giorno fa. Apertabug CLI skills
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openai/codex#63907 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug CLI
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openai/codex#63906 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
codex login status can panic when a saved API-key value contains non-ASCII textForse già presa @akhil9tiet l’ha presa 2 giorni fa. Apertaauth bug CLI
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
openai/codex#63868 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di openai/codex
Issue simili
-
My Caps shows "Shared" on private Caps that were never sharedForse già presa @AksharP5 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
CapSoftware/Cap#4569 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Document Web UIAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
parquet: reject truncated BYTE_STREAM_SPLIT numeric pages instead of silently fabricating valuesApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno