my name is Thomas and I am pretty new to powershell. I already searched the internet, but I can’t find an answer, so I hope you can provide some tips.
I am reading out some XML files with my powershell script and writing the content into an array.
At the end, when I just type in the array name into the console, I see the correct output in 3 tables. When I try to export it to csv using this code:
$DataArray | Export-Csv C:\Users\xxx\Desktop\report.csv -Delimiter ";" -NoTypeInformation
The created report.csv file shows the correct content in 3 tables, which is perfect. But there is one issue. The content contains a german umlaut like Ä,Ö,Ü and these are not displayed.
No problem, when I use -Encoding unicode, everything looks fine.
But now it gets weird:
As soon as I add the encoding
$DataArray | Export-Csv C:\Users\xxx\Desktop\report.csv -Delimiter ";" -Encoding Unicode -NoTypeInformation
Export-Csv seems to ignore the Delimiter, as from now on I will only have one table in the report.csv.
Can somebody please explain to me why this is happening? I need the data in 3 tables like I builded the array, but I also need it with the proper encoding.
Thank you very much for reading!