-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Windows
Description
Proposal: os/exec: Handle Windows Standard Streams Encoding
Currently, the os/exec package does not differentiate between the default behavior of different Windows versions regarding standard output and error encoding. This can lead to encoding issues when running commands that output non-UTF-8 characters in Windows with the "Use Unicode UTF-8 for worldwide language support" beta feature enabled.
Problem:
- Windows traditionally uses locale-specific encodings for console output (e.g.,
gbkin China). - Windows introduced a beta feature to enforce UTF-8 encoding for all console applications.
os/execdoes not account for this difference while gettingstdout, potentially leading to garbled output when this beta feature is not enabled.
Proposed Solution:
Introduce a mechanism in os/exec to handle Windows console encoding variations, specifically:
- Detection: Automatically detect if the Windows UTF-8 beta feature is active.
- Transparent Handling: Based on the chosen configuration, seamlessly handle encoding and decoding of output streams within
os/exec.
Benefits:
- Code can be more consistent by removing the need for platform-specific encoding workarounds.
- Improved compatibility with applications relying on UTF-8 output.
- Enhanced user experience by avoiding garbled characters in console output.
This feature request aims to improve the reliability and user-friendliness of os/exec when interacting with console applications in diverse Windows environments. Thank you to everyone who reviews this request.
renzhexiguarenzhexigua
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Windows