By operating with a file in UTF8 without BOM
$xml = New-Object xml
$xml.PreserveWhitespace = $true
$xml.Load($path)
...
$node.InnerText = '©' + (Get-Date).year
...
$utf8WithoutBom = New-Object System.Text.UTF8Encoding($false)
$sw = New-Object System.IO.StreamWriter($path, $false, $utf8WithoutBom)
$xml.Save($sw)
$sw.Close()
Result is shown incorrectly in the file
<copyright>©2022</copyright>
No effect as well by using:
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
In addition, untouched fields are preserved with copyright and other symbols.