Skip to content

Bash tool output shows mojibake for non-ASCII PowerShell output on Windows #543

Closed

Description

@agenteinstinct1-max

On Windows, bash/PowerShell tool output renders with mojibake for non-ASCII text: Área de Trabalho displays as ◆rea de Trabalho (seen in directory listings under OneDrive paths). Likely a codepage/encoding mismatch when decoding the child process output (e.g. output arriving as CP1252/OEM while decoded as UTF-8, or vice versa). Expected: force or negotiate UTF-8 output (e.g. chcp 65001 / [Console]::OutputEncoding) or decode using the console's actual codepage so accented paths render correctly.

Activity

  1. agenteinstinct1-max commented on Oct 24, 2026

    @agenteinstinct1-max
    CollaboratorAuthor

    Partial coverage merged in #563 to dev-vibecoded as 502b310a07b0554de4bb96693e0ac128a75eb43f.

    The PowerShell UTF-8 setup now covers the core argument builder, direct/legacy user-shell invocation and V2 Bash execution string. Exact-head Linux/Windows tests and typecheck passed, and the independent review approved that partial scope.

    This issue remains open: the cmd encoding path is not covered, and actual Windows console/TUI non-ASCII output has not been verified. Aggregate Windows CI success is not that runtime proof.

  2. agenteinstinct1-max commented on Oct 27, 2026

    @agenteinstinct1-max
    CollaboratorAuthor

    Native Windows result for the cmd.exe path (candidate PR #665, kept unmerged). Head c01ae7e, Windows unit job https://github.com/mdev34-lab/silvercode/actions/runs/40446224732/job/121998381607.

    Test: a file named ação-日本.txt created in a temp directory, then dir /b *.txt run through cmd.exe after the prefix <SystemRoot>\System32\chcp.com 65001>nul & , using both the argv form (Shell.args, piped stdio, windowsHide) and the spawn shell option (windowsHide). Controlled baseline: a separate child reported Active code page: 437, and an unwrapped echo was not UTF-8.

    Result: both wrapped shapes exited 7 and returned stdout bytes 61 87 61 6f 2d 3f 3f 2e 74 78 74 0d 0a (CP437 bytes; 0x87 is c-cedilla, other characters became ?), not UTF-8. A fresh child still reported code page 437 afterwards. So this prefix did not make cmd emit UTF-8 in the hidden/piped path the shell tools use.

    Limits: the reason is not established (a console-less hidden process is a hypothesis only); the shared-console effect on a parent was not measured; only this one prefix approach was tried. An earlier echo-based fixture was invalid (the literal accented character was already lossy before cmd ran) and is not used as evidence. This issue stays open; the cmd path needs a different, source-grounded approach.

  3. agenteinstinct1-max commented on Oct 28, 2026

    @agenteinstinct1-max
    CollaboratorAuthor

    Bounded Windows runner results from the diagnostic draft #678 (not merged, no fix proposed), head 46c5d6a, job https://github.com/mdev34-lab/silvercode/actions/runs/40715994127/job/122913825064. Shape modeled: Shell.args(cmd, command, cwd) (/c), piped stdio, hidden window; file named ação-日本.txt:

    • A plain dir /b: status 7, stdout bytes are CP437 (6187616f2d3f3f2e7478740d0a), not UTF-8.
    • B with the fix(shell): switch cmd.exe to a UTF-8 console codepage #665 prefix chcp.com 65001>nul &: identical bytes to A.
    • C with chcp output visible: the child printed Active code page: 65001 twice, yet the dir bytes were still the same CP437 bytes. So in this spawn chcp ran and reported 65001; why cmd's own output did not follow it is not established.
    • D (nested cmd /c after the prefix): invalid probe, the nested command line was mis-quoted and cmd reported it as not recognized. Not evidence about nested cmd.
    • ConPTY via @lydell/node-pty default backend, same shape: dir /b exit 7 and the data string contained the name intact; type of a UTF-8 file exit 7 but the text was mojibake (CP437 reading of UTF-8 bytes). Strings, not raw wire bytes; VT sequences present.

    Not shown: any fix, ConPTY with chcp 65001, mixed builtin and external producers, pipe or redirection semantics, native console behavior. #543 stays open. A follow-up probe on the ConPTY with and without chcp 65001 is queued on #678.

  4. agenteinstinct1-max commented on Oct 28, 2026

    @agenteinstinct1-max
    CollaboratorAuthor

    ConPTY follow-up from the diagnostic draft #678 (not merged, no fix proposed), head 2149f6d, Windows job https://github.com/mdev34-lab/silvercode/actions/runs/40723534586/job/122940825132. Default @lydell/node-pty backend, Shell.args shape, file ação-日本.txt, strings re-encoded as UTF-8 (not raw wire bytes), VT sequences present, every line exit /b 7:

    • P1 dir /b: exit 7, the name arrives intact in the text.
    • P2 type of a UTF-8 file: exit 7, mojibake (CP437 reading of the UTF-8 bytes).
    • P3 chcp.com 65001>nul & then dir /b: output identical to P1.
    • P4 chcp.com 65001>nul & then type: output identical to P2, still mojibake.

    So under ConPTY on this runner, the in-command chcp 65001 prefix changed neither the dir text nor the type bytes. Not shown: why, mixed builtin/external producers, other chcp placement (for example before launching the shell), pipe or redirection semantics, native console behavior. #543 stays open; no fix claim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions