I work regularly in PowerShell and this bugged tf out of me. The result of my digging was: .NET libraries emit textual output in <whatever the offending encoding was, UTF-16 LE or something> -- and since PowerShell is implemented in .NET, it necessarily inherited that default.
Things have improved since then now that everything is implemented in .NET (Core), so if you're working with PoSH 7.x, this is no longer a headache. (I just tested in 5.1, and it seems fixed now, as well.)
Of course, by now, I've just developed muscle memory to add '-enc UTF8' to the end of everything that writes text to disk.
Things have improved since then now that everything is implemented in .NET (Core), so if you're working with PoSH 7.x, this is no longer a headache. (I just tested in 5.1, and it seems fixed now, as well.)
Of course, by now, I've just developed muscle memory to add '-enc UTF8' to the end of everything that writes text to disk.