Fix mangled accents in Chocolatey output by decoding with the system console code page#4977
Merged
Gabriel Dufresne (GabrielDuf) merged 1 commit intoJun 22, 2026
Conversation
Marc-André Moreau (mamoreau-devolutions)
approved these changes
Jun 22, 2026
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.
This pull request improves how the application handles CLI output encodings for package managers, ensuring correct reading of console output from tools like Chocolatey that do not emit UTF-8. The main changes introduce a configurable
OutputEncodingproperty for package managers, defaulting to UTF-8 but allowing overrides for managers that use the system console code page. The process start logic is updated to use this encoding, preventing character corruption in CLI output.Encoding handling improvements:
Added a
ConsoleEncodingproperty toCoreDatathat detects and caches the system console code page, with a fallback to UTF-8 if detection fails.Updated the
IPackageManagerinterface to include anOutputEncodingproperty, defaulting to UTF-8 but overridable by specific managers.The base
PackageManagerclass andNullPackageManagernow provide a default implementation forOutputEncoding.Chocolatey-specific changes:
The
Chocolateypackage manager overridesOutputEncodingto useCoreData.ConsoleEncoding, ensuring correct output decoding for its CLI.All process invocations in Chocolatey and its helpers now use the manager's
OutputEncodingfor both standard output and error streams.Dependency updates:
System.Text.Encoding.CodePagesNuGet package to enable support for non-UTF-8 code pages.Process invocation updates:
OutputEncodingfor output and error streams.