# Convert all files to UTF-8 using powershell

> Source: <https://gist.github.com/jobou363/0d24a856246600d99e19776d4681d6ec>
> Published: 2018-07-27 19:22:15+00:00

Convert-Encoding.ps1

      This file contains hidden or 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

 
    Show hidden 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) 

	}
