encoding - Using PowerShell to write a file in UTF-8 without the BOM -


out-file seems force bom when using utf-8:

$myfile = get-content $mypath $myfile | out-file -encoding "utf8" $mypath 

how can write file in utf-8 no bom using powershell?

using .net's utf8encoding class , passing $false constructor seems work:

$myfile = get-content $mypath $utf8nobomencoding = new-object system.text.utf8encoding $false [system.io.file]::writealllines($mypath, $myfile, $utf8nobomencoding) 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -