Skip to content

Decode CLI streams without splitting UTF-8 characters - #855

Closed
xiehuanyi wants to merge 1 commit into
janl:masterfrom
xiehuanyi:fix/cli-utf8-decoding
Closed

xiehuanyi wants to merge 1 commit into
janl:masterfrom
xiehuanyi:fix/cli-utf8-decoding

Conversation

@xiehuanyi

Copy link
Copy Markdown

The CLI concatenates each stream's Buffer chunks into a string independently. A UTF-8 character split across chunks is therefore decoded as replacement characters: a template containing 65535 ASCII characters followed by €X renders with ���X instead of €X. JSON view files and partial files use the same reader and lose those characters too.

Set UTF-8 encoding on the stream so Node's decoder can retain an incomplete character until the next chunk. Add actual CLI regressions for templates, JSON views, and partials with a character at a 64KiB stream boundary. They check the complete rendered string and clean up their temporary files.

Validation: all three new cases fail on unchanged master. The full unit suite passes 299 tests with 13 existing pending after initializing the declared specification submodule. ESLint and git diff --check pass. Tested on Node 14.21.3/Linux; Windows and the legacy Node 0.10 matrix were not exercised. This branch starts from clean master and excludes PR #854's context-cache change.

AI disclosure: OpenAI Codex assisted with investigation, implementation, regression tests, and this description.

AI-assisted implementation and verification using OpenAI Codex.
Copilot AI balanced review requested due to automatic review settings October 10, 2026 18:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@xiehuanyi xiehuanyi closed this by deleting the head repository Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants