Skip to content

Runner decodes each output chunk separately, splitting multi-byte UTF-8 characters #331

Closed

Description

@Exeloo

Which package is this bug report for?

@nanoforge-dev/cli

Which command is this bug report for?

other

Issue description

The runner decodes each output chunk on its own with data.toString() (src/lib/runner/runner.ts#L92). When a multi-byte UTF-8 character falls across two chunks, each half decodes to U+FFFD and the captured output shows ��. This hits large outputs (chunks split at pipe-buffer boundaries) that hold non-ASCII text, such as accented file paths or localized error messages in a failure log.

Not fixed by #283 or its PR #291, which still decodes each chunk separately.

Reproduced on Node with the same per-chunk pattern (code sample): it prints "��" instead of "é".

Expected: collect the Buffers and decode them once (Buffer.concat(chunks).toString()), or call setEncoding("utf8") on the streams so Node's StringDecoder keeps split characters whole.

Found while reviewing PR #291.

Code sample

const { spawn } = require("child_process");
const child = spawn(process.execPath, ["-e",
  'const b = Buffer.from("é"); process.stdout.write(b.subarray(0, 1)); setTimeout(() => process.stdout.write(b.subarray(1)), 50)']);
const out = [];
child.stdout.on("data", (d) => out.push(d.toString()));
child.on("close", () => console.log(JSON.stringify(out.join("")))); // "��"

Versions

  • @nanoforge-dev/cli main (3be3ada)
  • Node.js 26
  • Linux

Issue priority

Low (slightly annoying)

I have tested this issue on a development release

3be3ada

Activity

  1. added
    bug
    on Nov 22, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions