Fix multi-byte UTF-8 decoding in Executable stream handling - #5510
Merged
David Michon (dmichon-msft) merged 3 commits intoSep 21, 2026
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix incorrect decoding of multi-byte characters in executable
Fix multi-byte UTF-8 decoding in Executable stream handling
Dec 18, 2025
David Michon (dmichon-msft)
approved these changes
Jan 2, 2026
David Michon (dmichon-msft)
left a comment
Contributor
There was a problem hiding this comment.
Copilot This change needs a patch changefile for node-core-library.
David Michon (dmichon-msft)
marked this pull request as ready for review
January 2, 2026 23:15
Member
|
Copilot - Generate a changefile documenting this change. It should be a patch bump. |
Contributor
Author
Daniel (D4N14L)
approved these changes
Jan 7, 2026
Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
David Michon (dmichon-msft)
force-pushed
the
copilot/fix-multi-byte-decoding
branch
from
September 21, 2026 21:15
b3e7021 to
624c17d
Compare
David Michon (dmichon-msft)
requested review from
Bharat Middha (bmiddha) and
Jonathon Anthony (jxanthony)
as code owners
September 21, 2026 21:15
Sean Larkin (TheLarkInn)
approved these changes
Sep 21, 2026
David Michon (dmichon-msft)
deleted the
copilot/fix-multi-byte-decoding
branch
September 21, 2026 22:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix multi-byte character decoding in Executable.waitForExitAsync
waitForExitAsyncto set encoding on stdout/stderr streamsgetProcessInfoByIdAsyncto set encoding on stdout streamSummary
This PR fixes an issue where
Executable.waitForExitAsyncandgetProcessInfoByIdAsyncincorrectly decoded multi-byte UTF-8 characters when they were split across chunk boundaries from stdout and stderr streams.Root Cause
Calling
chunk.toString(encoding)on individual buffer chunks produces invalid characters when multi-byte UTF-8 sequences are split across chunk boundaries.Solution
Set the stream encoding explicitly using
stream.setEncoding(encoding)before attaching data handlers. When encoding is set on a stream, Node.js automatically uses aStringDecoderinternally which maintains state across chunks and properly handles character boundaries.Changes Made
waitForExitAsync: Set encoding on stdout/stderr streams before attaching handlers (when encoding is not 'buffer')getProcessInfoByIdAsync: Set encoding to 'utf8' on stdout streamTesting
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.