The British Caving Association

Any views expressed are not necessarily those of the BCA
It is currently Sun 26 May 2019 14:18

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri 11 Jan 2013 13:53 
Offline
Site Admin

Joined: Thu 29 Dec 2005 23:22
Posts: 298
Location: Axbridge, Somerset, UK
David Gibson wrote:
On the off-chance one of you knows the answer to this... Do you know if, when files are FTPed to/from the web site, they undergo a format conversion, e.g. from CRLF to CR line endings?

Ive noticed something odd (well, odd to me). On the BCRA web server, the size of index.html is reported as 23932 bytes but Windows reports it as 24411, a difference of 479 bytes, which is the number of lines in the file.

Is there a format conversion going on, or do the systems count differently? Both seem odd - I mean, how does the server "know" to re-convert the file when I download it. (That is, it goes from 24411 to 23932 when I upload and, if I download that file, it becomes 24411 again.

_________________
Dave Cooke
BCA Webmaster, BCA Web Services, National Cave Registry Co-ordinator, CSCC Treasurer


Top
 Profile  
 
PostPosted: Fri 11 Jan 2013 14:03 
Offline
Site Admin

Joined: Thu 29 Dec 2005 23:22
Posts: 298
Location: Axbridge, Somerset, UK
They can do.

FTP can work in two modes, binary or ASCII format. In ASCII mode the end of line character is converted as appropriate to the destination computer's operating system - which is what you are seeing (LF becomes CRLF or vice versa).

In binary mode no translation occurs. The ftp client will make the decision as to which mode to be in. Check to see what is set in your options. It can be 'auto' based on file type or explicitly set to always be binary or always be ASCII.

I generally force everything to be binary so my binary files can't be accidentally corrupted and use a decent text editor that can cope with either ending for the text files.

_________________
Dave Cooke
BCA Webmaster, BCA Web Services, National Cave Registry Co-ordinator, CSCC Treasurer


Top
 Profile  
 
PostPosted: Fri 11 Jan 2013 14:34 
Offline
User avatar

Joined: Thu 16 Mar 2006 23:45
Posts: 477
Thanks for that, Cookie. I had assumed I was transferring everything in binary, but had also totally forgotten that the setting existed. I checked, and I was in Auto mode, and that is definitely what was causing the behavior I noticed. This explains another odd thing I had noticed...

I was puzzled (but not enough to investigate) why some files I downloaded always had unix-style endings and others had PC-style endings. My habit is is to store log data on the server in files with extension .txp which is associated on my PC with TextPad. But, of course, TXP is not in the default list of file extensions to be transferred in ascii mode [my FTP package allows me to edit that list]. Hence my puzzlement over the difference in TXT and TXP files.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group