Get-ChildItem . -recurse -File -filter *.txt* | % {[System.IO.File]::WriteAllLines is used instead of the more commonly used Out-File because the latter outputs UTF8-BOM instead of plain UTF.
$MyFile = Get-Content -Raw $_.Fullname
$MyPath = $_.Fullname
[System.IO.File]::WriteAllLines($MyPath, $MyFile, [System.Text.UTF8Encoding]($False))
}
Showing posts with label utf8. Show all posts
Showing posts with label utf8. Show all posts
Monday, July 30, 2018
Convert multiple text files to UTF encoding
If you have multiple files and want to convert them all into UTF (without BOM), you can try this PowerShell script.
Labels:
conversion,
multi file,
PowerShell,
utf8,
utf8-bom
Subscribe to:
Posts (Atom)