0

i don't know how to explain my issue, but i'm gonna try. i have a batch services that creates several text files and put them in a zip file.

there are two files that have a lot of white spaces. we are talking about thousand of white spaces between text.

the thing is this file that i've sent by email, when it is uncompressed it has less characters that it has to be. it should 10170 columns, but instead i have 10152.

this is the way that i've create the zip based on the stringbuilders.

 var mStream = new MemoryStream();
        using (var zip = new ZipArchive(mStream, ZipArchiveMode.Create, true))
        {
            foreach (var builder in Builders)
            {
                if (string.IsNullOrWhiteSpace(builder.Value.ToString()))
                    continue;
                var entry = zip.CreateEntry(builder.Key);
                var stream = entry.Open();
                var value = builder.Value.ToString().TrimEnd(Environment.NewLine.ToCharArray());
                var values = Encoding.GetEncoding(1252).GetBytes(value);
                stream.Write(values, 0, values.Length);
                stream.Close();
            }

        }

Then the stream is attached as a mail attachment.

thanks!

Rothariger
  • 293
  • 3
  • 22

0 Answers0