I have a very simple console application that creates a text file. Below is a recap of the code:
StreamWriter writer = File.CreateText("c:\\temp.txt");
foreach (blah...)
{
writer.Write(body.ToString() + "\n");
writer.Flush();
}
writer.Close();
The client is claiming there are carriage returns at the end of each line. Where are these carriage returns coming from?
Update: After opening in VS binary editor and Notepad++, there were no occurrences of 0d 0a. I’m going to go back to the client.
Open the file in the Visual Studio binary editor (File.Open.File, click down-arrow on Open button, choose Open With… and pick Binary Editor), and look for
0Dbytes. If none are present, then either:your client can’t tell the the difference between a line feed and a carriage return,
your transmission method is modifying the file en-route. Is there any FTP binary/ascii mismatch going on?
If there are
0Dbytes, then they are present in yourbodyvariable.