Skip to content

WIP: Support Powershell BOM encoding options

What does this MR do?

Autodetects whether a BOM should be included in a PowerShell script based on the shell used and the scripts contents.

Allows the option POWERSHELL_ENCODING to force a particular encoding, and therefore BOM inclusion.

Why was this MR needed?

In PowerShell 6+, the default encoding is UTF-8 without BOM on all platforms.

In Windows PowerShell, the default encoding is usually Windows-1252, aka latin-1/ISO 8859-1.

For Windows Poweshell, we should auto-detect when to include a BOM (when we detect the source is NOT latin-1) and provide options to explicitly encode with UTF8 with and without the BOM.

What are the relevant issue numbers?

Closes #26592 (closed)

Edited by Arran Walker

Merge request reports