in reply to Convert binary to ascii while sftp using Net::SSH2
When you transfer a file in binary mode, it remains unchanged (this mode is typically used to transfer compiled programs / BINaries).
When dealing with end of line characters in text files that roboticus elaborated on, ascii mode would have to be used to do a transformation of the end of line character to make it appropriate to the target platform. In perl, you would need to use a s/\r\n/\n/; to do the equivalent transform when doing a Windows -> UNIX transfer.
The reason for this madness lies in how early computer systems had to interact with teletype and typewriter devices that were unable to advance the print head to the next line in single character time (see Newline).
|
|---|