Skip to content

Force UTF-8 with BOM for Windows PowerShell shebang recipes#3095

Open
egasato wants to merge 1 commit intocasey:masterfrom
egasato:support-utf8-powershell
Open

Force UTF-8 with BOM for Windows PowerShell shebang recipes#3095
egasato wants to merge 1 commit intocasey:masterfrom
egasato:support-utf8-powershell

Conversation

@egasato
Copy link

@egasato egasato commented Feb 19, 2026

As explained in #3094, Windows PowerShell support is not full due to encoding issues.

The default encoding (codepage) used by conhost.exe (Console Window Host) may vary depending on the display language and region of the system (e.g. 437 for US English, 850 for Western European languages), but it's certainly never 65001 for UTF-8 (still an experimental feature). Moreover, even if UTF-8 was the default codepage, correct execution should not depend on system-wide settings that can potentially be changed.

Forcing the UTF-8 Byte Order Mark to be present when the shebang recipe is for Windows PowerShell fixes most (if not all) output encoding issues.

Windows PowerShell (`powershell.exe`) is included in all modern Windows
installs, and it's usual to leverage it when a recipe is complex enough
to require basic control flow constructs (which `cmd.exe` usually lacks
or it's unreadable).

The default encoding (codepage) used by `conhost.exe` (Console Window
Host) may vary depending on the display language and region of the
system (e.g. 437 for US English, 850 for Western European languages),
but it's certainly never UTF-8 (codepage 65001; still an experimental
feature that has to be enabled system-wide).

Forcing the UTF-8 Byte Order Mark to be present when the shebang recipe
is for Windows PowerShell fixes many output encoding issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant