cd /news/developer-tools/convert-all-files-to-utf-8-using-pow… · home topics developer-tools article
[ARTICLE · art-11494] src=gist.github.com ↗ pub= topic=developer-tools verified=true sentiment=· neutral

Convert all files to UTF-8 using powershell

The article provides a PowerShell script named `Convert-Encoding.ps1` that converts files (specifically `.aspx`, `.master`, and `.cs` files) to UTF-8 without a Byte Order Mark (BOM). The script excludes certain directories and file patterns (like `**Debug**`, `**bin\**`, and `*.Designer.cs`) and uses `System.Text.UTF8Encoding` to rewrite each file's content in UTF-8 encoding.

read1 min views22 publishedJul 27, 2018

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
	[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) 

	}
── more in #developer-tools 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/convert-all-files-to…] indexed:0 read:1min 2018-07-27 ·