fix(interpreter): decode each statement's stdout via stdoutKind to fix UTF-8 mojibake (#272)
A single exec() can interleave text-shaped statements (sed, awk, echo — ö as U+00F6) with byte-shaped ones (grep | head, cat — ö as bytes 0xC3 0xB6). executeScript / executeStatement concatenated each result's raw stdout, so the lone high byte from the text half made the combined stream invalid UTF-8, the output-boundary decoder bailed, and the byte half came back as Latin-1 mojibake (Köpenicker for Köpenicker). The same path backs command substitution, so echo "…: $(cat /file)" was affected too. Decode each statement/pipeline result to text via its explicit stdoutKind (decodedTextFromResult) before concatenating — no guessing from string contents, so text whose code units merely look like UTF-8 (ö) is preserved. The shape is declared per output rather than per command: tac (stdin path) and curl (response body) now set stdoutKind: "bytes" on the results that forward raw bytes; the rest already self-mark via stdoutKind / the legacy stdoutEncoding alias. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
L
Lars Trieloff committed
150a915a1d45a2cc7f2b6aec3268f27116c34916
Parent: efabdb7
Committed by GitHub <noreply@github.com>
on 6/18/2026, 2:46:58 PM