Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Using PowerShell to write a file in UTF-8
SUBMITTED BY:
Guest
DATE:
Dec. 12, 2013, 1:49 a.m.
FORMAT:
Text only
SIZE:
322 Bytes
Raw
Download
Tweet
HITS:
19659
Go to comments
Report
Using PowerShell to write a file in UTF-8 without the BOM
$MyFile = Get-Content $MyPath
$MyFile | Out-File -Encoding "UTF8" $MyPath
$MyFile = Get-Content $MyPath
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding($False)
[System.IO.File]::WriteAllLines($MyPath, $MyFile, $Utf8NoBomEncoding)
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus