问题描述
我正在研究一个相当简单的SSIS包,该包使用ODBC Source从DB2读取并将其带到平面文件目的地。但是我需要生成的文件为UTF-8(不带BOM),而不是ANSI,因为它是SSIS自动生成的。最适合我的是下面的代码,但它将其转换为UTF-8 BOM,客户端告诉我带有BOM的文件不适用于他。有什么办法可以使文件为UTF-8?
string srcFilename = Dts.Variables["User::FFDestPath"].Value.ToString();
string text = File.ReadAllText(srcFilename);
File.WriteallText(srcFilename,text,System.Text.Encoding.UTF8);
Encoding utf8WithoutBom = new UTF8Encoding(false);