Forked from jamesfdickinson/Convert-Encoding.ps1
Last active
December 5, 2020 18:29
-
-
Save jobou363/0d24a856246600d99e19776d4681d6ec to your computer and use it in GitHub Desktop.
Convert all files to UTF-8 using powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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