Hello. I need to convert several html files , located in C:\Folder1 from UTF-8 to UTF-8-BOM.
I had try these two variants with windows Powershell, but non of them works:
get-item C:\Folder1*.* | foreach-object {get-content -Encoding utf8BOM $_ | out-file ("C:\Folder1" + $_.Name) -encoding default}
OR
$MyPath = "C:\Folder1"
Get-ChildItem -Path $sourcedir -Filter *.html | ForEach-Object {
# This variable can be reused
$utf8 = New-Object System.Text.UTF8Encoding $false
$MyFile = Get-Content $MyPath -Raw
Set-Content -Value $utf8.GetBytes($MyFile) -Encoding Byte -Path $MyPath
}
Does anyone know the solution?