Wednesday, May 16, 2012

skipping Byte Order mark (BOM) when using Stream CopyTo

I am trying to merge files into an output file and my individual files have the BOM on them, how can I get rid of it while using Stream.CopyTo method..



My code looks like this:



using (var output = File.Open(outputFile,FileMode.Append,FileAccess.Write))
{
foreach (var inputFile in inputFiles)
{
using (var input = File.OpenRead(inputFile))
{
input.CopyTo(output);
}
}
}




No comments:

Post a Comment