Reputation: 2077
I'm using SharpSSH to transfer xml files to a unix machine. Here is the code that writes the files:
public override void WriteFile(string directoryName, string fileName, string responseText) {
try {
sshExec.RunCommand(@"echo """ + responseText + @""" > " + directoryName + "/" + fileName);
} catch (Exception e) {
log.Error("Failed to write file at " + directoryName + "/" + fileName);
throw new Exception("Failed to write file to " + directoryName + "/" + fileName, e);
}
}
The problem is that these files fail XSD validation. When checking them before transfer they pass the validation. I had a suspicion that the problem is that they get copied in ASCII mode, and specifically the issue may be the end of line character. We had this issue before when using WinSCP until we configured it to transfer in binary mode.
Its important to say that the even though the receiving application is running on unix, it does expect windows character set and knows how to handle it.
The developer of SharpSSH claims the implementation supports binary mode only.
Does anyone have any experience with this library and can shed light on this?
Edit
It seems that the response is sent without any Crlf characters so I'm completely stumped now.
Upvotes: 3
Views: 630