使用ISO-8859-15编码从SQL Server导出为CSV文件

时间:2016-08-25 10:47:13

标签: sql-server csv powershell

我正在尝试将SQL Server数据库导出为CSV文件。为此,我使用的是PowerShell脚本。

如您所见,在数据库中我有一些特殊字符(丹麦语)。

capture of my database table

但是在导出的文件中,这些字符被替换为?如下所示:

csv output file

有关信息,在我的powershell脚本中,这是导出文件的行:

$ DataSet.Tables [0] | Export-Csv $ extractFile -NoTypeInformation -Encoding“ISO-8859-15”

有人可以帮忙吗?谢谢!

编辑:

@JamesQMurphy这里是代码

dataset

1 个答案:

答案 0 :(得分:1)

经过测试,我的正确编码是BigEndianUnicode

将您的编码更改为:

$DataSet.Tables[0] | Export-Csv $extractFile -NoTypeInformation -Encoding BigEndianUnicode