Skip to content

Fix mangled accents in Chocolatey output by decoding with the system console code page#4977

Merged
Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
fix/chocolatey-output-encoding
Jun 22, 2026
Merged

Fix mangled accents in Chocolatey output by decoding with the system console code page#4977
Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
fix/chocolatey-output-encoding

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

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 OutputEncoding property 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 ConsoleEncoding property to CoreData that detects and caches the system console code page, with a fallback to UTF-8 if detection fails.

  • Updated the IPackageManager interface to include an OutputEncoding property, defaulting to UTF-8 but overridable by specific managers.

  • The base PackageManager class and NullPackageManager now provide a default implementation for OutputEncoding.
    Chocolatey-specific changes:

  • The Chocolatey package manager overrides OutputEncoding to use CoreData.ConsoleEncoding, ensuring correct output decoding for its CLI.

  • All process invocations in Chocolatey and its helpers now use the manager's OutputEncoding for both standard output and error streams.

Dependency updates:

  • Added the System.Text.Encoding.CodePages NuGet package to enable support for non-UTF-8 code pages.

Process invocation updates:

  • All package operation process invocations now consistently use the package manager's OutputEncoding for output and error streams.

@GabrielDuf Gabriel Dufresne (GabrielDuf) merged commit 2b555fc into main Jun 22, 2026
3 checks passed
@GabrielDuf Gabriel Dufresne (GabrielDuf) deleted the fix/chocolatey-output-encoding branch June 22, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants