jnikodym
asked on
Powershell Command to create a csv file using UTF-8 encoding
I have a powershell command that is calling a sql query to create a csv file. The file is being created as encoded as Unicode. I need the file to be encoded as UTF-8. Is there a command i can add to my code to have the file created as UTF-8?
ASKER
Below is the code that exports the csv file
$outFile = "C:\iqs\customers.csv"
$result = GetSQL $query
$result | ConvertTo-Csv -Delimiter "|" -NoTypeInformation | % {$_.Replace('"','')} | Out-File $outFile
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you are using Export-Csv to export the data to csv then you can use the -Encoding parameter..
Example..
Open in new window