Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1038

Write-Output with no BOM

$
0
0

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.


Viewing all articles
Browse latest Browse all 1038

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>