Yummy Software
Welcome, Guest. Please login or register.
April 30, 2009, 11:47:49 AM
3403 Posts in 656 Topics by 727 Members
Latest Member: frdr
Home Help Search Login Register
Yummy Software  |  Yummy FTP  |  Problems & Bugs  |  Line ending issue « previous next »
Pages: [1] Print
Author Topic: Line ending issue  (Read 159 times)
ontology
Newbie
*
Posts: 2


View Profile
Line ending issue
« on: April 10, 2009, 07:53:15 PM »

I have files that are on a Linux server, but have Windows CR LF line endings.  If I transfer these files from the server to the Mac in binary mode, I get the CR LF as expected.  If I transfer in ASCII, or Automatic I will get LF LF (with Use Unix line endings checked), or CR CR (with Use Unix line endings unchecked).

I expected the line endings to be unchanged, as CR LF with the Use Unix line endings unchecked.
I expected the line endings to be changed to a single LF with the Use line endings checked.

Am I doing something wrong?

Thanks.
Logged
spacific
Sr. Member
****
Posts: 211


View Profile
Re: Line ending issue
« Reply #1 on: April 10, 2009, 09:22:09 PM »

Weird!

Just to be clear: how are you assessing the line endings on your Mac?  Are you using a hex dump of the files, or are you using some text editor. If the latter, are you sure that the editor isn't changing line endings as well?

Logged
JD
Administrator
FTP Guru
*****
Posts: 1507


View Profile Email
Re: Line ending issue
« Reply #2 on: April 11, 2009, 04:10:46 AM »

The problem is that this cannot be solved using ASCII mode transfers, because line endings must be represented as CRLF pairs during transmission (as is required by the FTP protocol specification for ASCII transfers), and while this works without problems when the source file has line endings which are native to the platform, in the case of foreign line endings in a source file, you can get unexpected results.

eg:-
Linux (and Mac OS X and all Unix based systems) use LF as a line eding
Windows uses CFLF as a line ending
Mac OS (classic) uses CR as a line ending

So for the Linux server, transferring an ASCII file with CFLF as the line endings in the file, results in the server translating each LF into a CRLF pair, resulting in each line ending with CRCRLF. The only reasonable thing Yummy can do is to translate the CRLF pair back to the platform line ending (Mac OS X uses LF) and that leaves a line with a CR so Yummy replaces that with the platform line ending too.

There's no good way around this other than:

a) Correct the line ending on the server
b) Use Binary mode transfers

Logged
spacific
Sr. Member
****
Posts: 211


View Profile
Re: Line ending issue
« Reply #3 on: April 11, 2009, 08:00:17 AM »

Quote
There's no good way around this other than:
a) Correct the line ending on the server
b) Use Binary mode transfers

or
c) Don't use Windows!    Grin

(This is all rather disturbing really, isn't it, if you think of it in general terms. That while the computer world has adopted standards for all manner of connectivity, hardware conventions, dns, ip, html, css, ..., it can't agree on a single standard for a line ending  Shocked)
Logged
ontology
Newbie
*
Posts: 2


View Profile
Re: Line ending issue
« Reply #4 on: April 11, 2009, 09:25:32 AM »


So for the Linux server, transferring an ASCII file with CFLF as the line endings in the file, results in the server translating each LF into a CRLF pair, resulting in each line ending with CRCRLF. The only reasonable thing Yummy can do is to translate the CRLF pair back to the platform line ending (Mac OS X uses LF) and that leaves a line with a CR so Yummy replaces that with the platform line ending too.

OK.  Thanks for the update & I understand now.  I will use binary transfers for now.

Note that I have another FTP client that is able to FTP these files from the linux server to the mac, and translate the line endings to a single LF.  But I prefer to use Yummy.

BTW, I am viewing the files on the Mac with a binary file editor.


Logged
paulc
Full Member
***
Posts: 172


View Profile
Re: Line ending issue
« Reply #5 on: April 11, 2009, 11:48:05 AM »


c) Don't use Windows!    Grin

(This is all rather disturbing really, isn't it, if you think of it in general terms. That while the computer world has adopted standards for all manner of connectivity, hardware conventions, dns, ip, html, css, ..., it can't agree on a single standard for a line ending  Shocked)

Ha, you made me almost go on a 10 page rant about "hi-ascii" characters on Redmond software, something that plagued the hell out of my when I was championing all electronic production back in the eighties.
Logged
Pages: [1] Print 
« previous next »
Jump to: