Powershell: Export-Csv and non-English letters

The Export-Csv cmdlet is a really nice tool if you want to gather info from e.g. Active Directory that you later want to import to Excel. But as you might have noticed it doesn’t play well with non-English letters.

Working in Norway with users from all the Nordic countries means that we have a lot of users i Active Directory who have non-English letters in their names (æ ø å ö ä and so on). Unless you specify which encoding Export-Csv should use they will show in the csv as ?.

The magical switch to Export-Csv is -encoding. E.g. for us we would use unicode as encoding as this will export the Nordic letters:

Export-Csv <filename> -Encoding unicode

 

 

 

 

 

 

2 comments on “Powershell: Export-Csv and non-English letters

Leave a Reply

Your email address will not be published. Required fields are marked *