Skip to content

Support running a native command with alternate output encoding #16868

@segevfiner

Description

@segevfiner

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 activeCodePage in 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 .NET Process class 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 the StandardOutputEncoding). Or some new syntax for it, such as a special cast.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.Resolution-No ActivityIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions