Skip to content

Instantly share code, notes, and snippets.

@jobou363
Forked from jamesfdickinson/Convert-Encoding.ps1
Last active December 5, 2020 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jobou363/0d24a856246600d99e19776d4681d6ec to your computer and use it in GitHub Desktop.
Save jobou363/0d24a856246600d99e19776d4681d6ec to your computer and use it in GitHub Desktop.
Convert all files to UTF-8 using powershell
# encrypt files to utf-8 no bom
[string[]]$Excludes = @('**Debug**', '**bin\**', '*TemporaryGeneratedFile*.cs', '*.Designer.cs')
Get-ChildItem . -recurse -Include *.aspx, *.master, *.cs -Exclude $Excludes | ForEach-Object {
$content = $_ | Get-Content
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
$_.Fullname
[System.IO.File]::WriteAllLines($_.Fullname, $content, $Utf8NoBomEncoding)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment