Guest User

Untitled

a guest
Jun 23rd, 2012
1,371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. Using PowerShell to write a file in UTF-8 without the BOM
  2. $MyFile = Get-Content $MyPath
  3. $MyFile | Out-File -Encoding "UTF8" $MyPath
  4.  
  5. $MyFile = Get-Content $MyPath
  6. $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding($False)
  7. [System.IO.File]::WriteAllLines($MyPath, $MyFile, $Utf8NoBomEncoding)
Advertisement
Add Comment
Please, Sign In to add comment