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:

image

image

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.

image

Hope this helps!

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

Advertisements

5 thoughts on “Saving multiple files in a folder as UTF-8 encoded using PowerShell

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s