Support Powershell BOM encoding options
Summary
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.
Proposal
For Windows Powershell, we could 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.
Or, for Windows Powershell we always include BOM, but don't include BOM for Powershell Core.
Edited by Arran Walker