Illegal characters in SFTP File upload

Jan 23, 2015 at 12:56 PM
Edited Jan 23, 2015 at 12:59 PM
Im reading a text file from Windows into a file stream, then uploading it to openVMS.

The file uploads but when I look at it in openVMS each line has some sort of linebreak on the end that looks like a []

Is there a way I can stop these getting input?

Here is my code:
            PasswordAuthenticationMethod authMethod = new PasswordAuthenticationMethod("Buck", "Rogers");
            ConnectionInfo connectionInfo = new ConnectionInfo("space", "Buck", authMethod);

            SftpClient client = new SftpClient(connectionInfo);

           client.Connect();
           var fs = File.OpenRead(@"C:\temp\thistest.txt");
            client.ChangeDirectory("DSA31:[COMPANY.AUTOMATION31]");

            client.UploadFile(fs, "thistest.COM");


            client.Disconnect();
Jan 23, 2015 at 3:49 PM
Windows and Unix-Like OS have different definitions of a newline:
http://en.wikipedia.org/wiki/Newline#Common_problems

If you transfer a file between them, you have to handle it yourself.
For example see git: https://help.github.com/articles/dealing-with-line-endings/
Feb 5, 2015 at 9:08 AM
I see so I think ill need to change the code in UploadFile to remove these breaks?