powershell import-csv mangles diacritical characters

2

I am trying to create users in AD (2003 server R2) from a CSVfile using PowerShell (v2)

when I use import-csv the resulting data gets mangled when names have diacritical characters in them. Jerónimo ends up as Jer?nimo. Daniëlle ends up as Dani?lle etc.

If I output the file in de PS console using Type or get-content all is well:
PS> type .\Users.csv
PS> get-content .\Users.csv
The above commands result in the characters being displayed correctly so I'm pretty sure it is not it is not a consoleissue.

Does anyone have a solution to this or can explain this behaviour?

Regards, Peter Berkhout

Peter Berkhout

Posted 2011-05-13T05:00:21.110

Reputation: 21

1

The problem seems to be in the handling of ascii/unicode. a2u.bat solved the problem for me. http://www.robvanderwoude.com/batexamples.php?fc=A#A2U

– Peter Berkhout – 2011-05-14T11:14:55.313

Answers

0

Use the -Encoding parameter of Import-Csv:

Import-Csv -Encoding UTF7 -Path Users.csv

Andy Arismendi

Posted 2011-05-13T05:00:21.110

Reputation: 312