Preserving Special Characters in Excel-generated CSV files

by Nov 6, 2012

When you save Excel spreadsheets to a CSV file, special characters get lost. That's because Excel is saving the CSV file using very simple ANSI encoding.

The following line re-encodes the CSV file and uses UTF8 encoding, making special characters readable for Import-CSV:

$Path = "c:\somepathtocsv.csv"
(Get-Content $Path) | Set-Content $Path -Encoding UTF8

Twitter This Tip! ReTweet this Tip!