If I run a command like this:
Write-Output March > a.txt
I get this result:
U+FEFF M U+004D a U+0061 r U+0072 c U+0063 h U+0068 U+000D \n U+000A
I do not want the BOM. I tried different actions, like this:
$OutputEncoding = [System.Text.UTF8Encoding]::new($false)$PSDefaultParameterValues['*:Encoding'] = 'utf8'[Console]::InputEncoding = [System.Text.UTF8Encoding]::new($false)[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)
but none of them seem to address the issue. Note I am using PowerShell 5.1. Idid see some similar questions, but not quite the same issue as this, as theywere dealing with piping and external commands.