Repository navigation
Add -OutputEncoding for decoding program output - #12
Merged
Merged
Conversation
Output was always decoded in the console's code page, so a program
that writes UTF-8 came back garbled on a default console (code page
437): "café" read as box-drawing characters. -OutputEncoding takes a
name ('utf-8', 'utf8'), a code page number or an Encoding, on
Start-PkProcess, Invoke-PkProcessWithTimeout and Invoke-PkProcessBatch,
plus an OutputEncoding key on batch commands and dispatcher jobs.
Unset, behaviour is unchanged, since Windows' own tools write in the
console code page. An unknown name fails with a clear message.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 28, 2026
…ding in callbacks
The parameter shares its name with PowerShell's preference variable, and
the batch's closures captured it, so an -OnComplete scriptblock saw the
kit's value (empty, or a string) instead of PowerShell's Encoding. The
value now moves to a kit-private name before the closures are built.
Also asserts that a code page given as text ('437') works.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What was wrong. Program output was always decoded in the console's code page. On a default Windows console (code page 437), a program that writes UTF-8 came back garbled. A test program printing
café 日本語came back ascaf├⌐ .... Many cross-platform command-line tools write UTF-8, so non-ASCII file names in their output were mangled.What changed.
-OutputEncodingonStart-PkProcess,Invoke-PkProcessWithTimeoutandInvoke-PkProcessBatchsets how stdout/stderr are decoded.'utf-8','utf8'), a code page number, or a[System.Text.Encoding].OutputEncodingkey, which overrides the batch-wide value.The README covers it next to the timeout option.
Testing.
'utf-8'decodes both intact;main(no such parameter).🤖 Generated with Claude Code