Saving multiple files in a folder as UTF-8 encoded using PowerShell

Sometimes, you have files encoded as either ANSI or Unicode in your Windows Store App project. Those files will cause the Windows App Certification Kit (WACK) test to fail. To fix the issue, you can manually save each file and set the Advanced Save Options to UTF-8 like this:



But it’s not fun if you have many files that you have to convert to UTF-8 encoded.

If that is the case, this simple PowerShell script could help!

Just copy and paste it to PowerShell ISE and Run the script and all of your files should have been saved as UTF-8.


Hope this helps!

UPDATE: We can also use the Get-ChildItem with -Recurse option to get all files in subdirectories as well.