Idera nSoftware Compellent

PowerShell.com

Welcome to PowerShell.com, the educational and community site for Windows PowerShell People. Get a quick overview.

Latest Blog Posts

03-19-2010 - Hey, Scripting Guy! Quick-Hits Friday: The Scripting...
03-18-2010 - Enable-ICMP.ps1
03-18-2010 - New-ExcelWorkbook.ps1

PowerTip of the Day

Email my PowerTip:
Twitter my PowerTip:

Export CSV with Culture-Specific Delimiter

Export-CSV used to only support the comma as separator, which caused problems on non-U.S.-systems. In PowerShell v.2, with -useCulture you can have Export-CSV use whatever delimiter is the right one, depending on your culture.

There is only one caveat: You should never combine -useCulture with -Encoding Unicode. This seems to be a bug where the culture-specific delimiter is not inserted correctly, which causes importing applications, such as Export, to ignore it.

You should use -Encoding UTF8 instead if you want to preserve special characters in your export:

Get-Process | Select-Object Name, Company |
Export-CSV -useCulture -Encoding UTF8 $home\export.csv

Twitter This Tip! ReTweet this Tip!

Copyright 2010 PowerShell.com. All rights reserved.