-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Support running a native command with alternate output encoding #16868
Copy link
Copy link
Closed
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary of the new feature / enhancement
Powershell currently defaults to the console output encoding when running a native command. (NativeCommandProcessor.cs:1330). This is the right default for most programs, but some software chooses to output a different encoding instead (Most commonly UTF-8). e.g. Rust programs, or programs that use
activeCodePagein their manifest.The problem is that there is no way to specify an alternate encoding using Powershell syntax. This leads to either having to temporarily change
[Console]::OutputEncoding, or to run the process using the .NETProcessclass directly: starship/src/init/starship.ps1:26-65.It would help if there was a builtin way to do this concisely.
Proposed technical implementation details (optional)
Either a parameter to some cmdlet (
Start-Process? Not sure if that one allows reading output, not to a file, though... ) that allows setting theStandardOutputEncoding). Or some new syntax for it, such as a special cast.