Converting Excel CSV to UTF8

by Oct 3, 2013

When you export Microsoft Excel spreadsheets to CSV files, Excel by default saves CSV files in ANSI encoding. That's bad because special characters will break once you import the data into PowerShell using Import-Csv.

To make sure special characters won't get lost, you can make sure the CSV file uses UTF8 encoding before you import the data:

$Path = 'c:\temp\somedata.csv'

(Get-Content -Path $Path) | Set-Content -Path $Path -Encoding UTF8 

Twitter This Tip! ReTweet this Tip!