orca icon indicating copy to clipboard operation
orca copied to clipboard

Chinese text sometimes garbled in Codex on Windows (WSL)

Open AmethystLiang opened this issue 4 months ago • 2 comments

Description

Chinese text appears as garbled characters when running Orca commands (e.g., orca-ide computer get-app-state) in WSL on Windows. The output shows mojibake instead of the original Chinese characters.

Image

Steps to Reproduce

  1. Run an Orca command in WSL that outputs Chinese text (e.g., orca-ide computer get-app-state --app Orca --window-id <id> --json)
  2. Observe the output in the terminal

Expected Behavior

Chinese characters should display correctly.

Actual Behavior

Chinese characters are garbled/mojibake. Example output:

Environment

  • OS: Windows with WSL (Ubuntu)
  • Shell: CMD.EXE inside WSL
  • Orca: latest

Context

Reported by user in WeChat group. The issue appears specific to Windows/WSL environments where non-ASCII (Chinese) characters are not being encoded/decoded properly between the Orca process and the terminal output.

Made with Orca 🐋

AmethystLiang avatar Jul 13 '26 04:07 AmethystLiang

I'd like to work on this. I dug into the root cause: the CLI's own stdout is correct UTF-8 (src/cli/format.ts just does console.log(JSON.stringify(...))), so this isn't a CLI encoding bug. The mojibake comes from wsl.exe re-encoding a child process's output for the host console's active codepage unless WSL_UTF8=1 is set — this codebase already has that fix in one call site (src/main/agent-hooks/wsl-hook-relay-launch.ts) but two sibling wsl.exe spawn sites in the Codex WSL integration were missing it.

Opening a PR that:

  • adds WSL_UTF8: '1' to the two missing execFile('wsl.exe', ...) call sites for consistency with the existing pattern
  • adds a regression test on each that fails without the fix and passes with it
  • notes in the orca-cli skill guide that a bare cmd.exe -> wsl.exe console outside Orca's own terminals still needs chcp 65001 first, since Orca doesn't own that console and can't force its codepage

PR: will link shortly.

Chang-Jin-Lee avatar Jul 16 '26 09:07 Chang-Jin-Lee

Agent reproduction package (Windows orchestration 2026-07-16)

Host context: Windows 11 / Orca 1.4.143.0 / repo path used: docs/bug-reproductions/
Labels applied: see issue labels (has_repro or cannot_repro).
Security: Do not run user-uploaded binaries from issue attachments. Recreate fixtures from the steps/scripts below.


Issue 8475 — Chinese text garbled in Codex on Windows (WSL)

Status: needs_setup
Host: Windows 11, Orca 1.4.143
Label: none

Summary

Reporter: Chinese text from Orca CLI (e.g. orca-ide computer get-app-state) appears as mojibake under WSL on Windows (CMD.EXE-in-WSL context). Expected correct CJK; actual garbled output.

Environment gates (this host)

Need Present
Working WSL to run orca / orca-ide inside distro No — hung
Host orca computer Works (orca status / computer list-apps OK)
Console code page 437 (OEM US) — unsafe for UTF-8 CJK

What we verified

chcp   # Active code page: 437
[Console]::OutputEncoding  # ibm437
orca status --json         # ok
orca computer list-apps --json  # ok on host

Could not run the issue’s WSL path:

# intended, blocked by hung WSL
wsl -d Ubuntu -- bash -lc 'orca-ide computer get-app-state --app Orca --json'

Host console CP 437 is a known footgun: UTF-8 Chinese decoded as OEM/legacy produces mojibake. PowerShell browse path already pins UTF-8 for remote Windows listing (ssh-browse.ts); WSL/CLI path may still inherit legacy code pages.

Repro (another agent) when WSL healthy

  1. Ensure Windows UI language / a window title or accessibility tree contains Chinese, or create fixture text with CJK.
  2. From WSL: run orca-ide computer get-app-state --app Orca --json (or any command that emits Chinese).
  3. Compare host PowerShell (chcp 65001 / UTF-8) vs WSL terminal output.
  4. Capture raw bytes if possible (| xxd).

Evidence

  • docs/bug-reproductions/issues/8475.json
  • docs/bug-reproductions/evidence/8475-encoding-probe.json
  • docs/bug-reproductions/evidence/8475-app-state-win.json (host capture; may not include Chinese)
  • WSL blocked: #8941 evidence

Why blocked

WSL command execution hung; cannot demonstrate Codex/WSL terminal mojibake end-to-end on this machine right now.


How another agent should use this

  1. Read this comment fully (status, expected vs actual, blockers).
  2. If a script is included above, copy it to a temp file and run it on a Windows 11 host with Orca installed (prefer production install under %LOCALAPPDATA%\Programs\orca).
  3. Capture evidence (CLI --json, screenshots, logs) under a local folder; optionally comment results back here.
  4. If status is cannot_repro / needs_setup, satisfy the listed prerequisites first, then re-attempt and flip labels: remove cannot_repro, add has_repro when conclusive.

OrcaWin avatar Jul 17 '26 00:07 OrcaWin