This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Webmaster forum > September 2006 > When to use ASCII or BINARY for FTP...





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author When to use ASCII or BINARY for FTP...
ship

2006-09-24, 6:59 pm

Linux
Windows XP Pro (SP2)
Beyond Compare 2 (plus Dreamweaver to author)



Hi

Please can someone explain to me when to use ASCII and when to use
BINARY for FTP!

I am having trouble getting the file *sizes* to stay the same when
I transfer HTML if I use ASCII to transfer. But SOMETIMES when
I use BINARY to transfer it then seems to create double spacing
in my HTML source.

Even more bizarrely FTP download transfers from certain folders seem
to behave differently: Some hold their files sizes, and some dont.

And filesize is important not least because Beyond Compare 2
is using it to tell me which files are the same or not!

Mightily confused...

Can anyone put me out of my misery?!



Ship
Shiperton Henethe

William Tasso

2006-09-24, 6:59 pm

Fleeing from the madness of the http://groups.google.com jungle
ship <shiphen@XXXXXXXXXX> stumbled into news:alt.www.webmaster
and said:

> ...
> Mightily confused...
>
> Can anyone put me out of my misery?!


sorry - not permitted in the UK (and other territories)

--
William Tasso

http://williamtasso.com/words/what-is-usenet.asp
Mark Goodge

2006-09-24, 6:59 pm

On 20 Sep 2006 03:05:05 -0700, ship put finger to keyboard and typed:

>Linux
>Windows XP Pro (SP2)
>Beyond Compare 2 (plus Dreamweaver to author)
>
>
>
>Hi
>
>Please can someone explain to me when to use ASCII and when to use
>BINARY for FTP!


Simple: ASCII for text files (including HTML, Perl, PHP, CSS and ASP
files) and binary for binary files (including images, audio and pdf).

>I am having trouble getting the file *sizes* to stay the same when
>I transfer HTML if I use ASCII to transfer. But SOMETIMES when
>I use BINARY to transfer it then seems to create double spacing
>in my HTML source.


Filesize is entirely irrelevent; different operating systems will
measure the space taken up by a text file in different ways and hence
report a slightly different filesize. A text file is not just the
contents, it's also the associated header information (the data that
defines the file to the OS), and that's going to be OS-dependent and
will therefore affect the reported size. There is no reason at all why
it should matter that they are not quite the same on the remote system
as on your local system.

Transferring a text file in binary, on the other hand, risks
corrupting the file in odd ways such as the double spacing that you've
mentioned. It won't usually be a major problem, but it can be
irritating (and it can break script files if the line endings are
converted in the process).

Mark
--
Please help a cat in need: http://www.goodge.co.uk/cat/
Matt Probert

2006-09-24, 6:59 pm

On 20 Sep 2006 03:05:05 -0700, "ship" <shiphen@XXXXXXXXXX> wrote:

>Linux
>Windows XP Pro (SP2)
>Beyond Compare 2 (plus Dreamweaver to author)
>
>
>
>Hi
>
>Please can someone explain to me when to use ASCII and when to use
>BINARY for FTP!
>
>I am having trouble getting the file *sizes* to stay the same when
>I transfer HTML if I use ASCII to transfer. But SOMETIMES when
>I use BINARY to transfer it then seems to create double spacing
>in my HTML source.


I guess someone had better explain....

Unix and Microsoft o/s handle text files differently!

When you use "ascii" as a FTP mode, the files may be changed,
particularly with regard to carriage return/line feed pairs

When you use "binary" as a FTP mode, the files remain constant.

HOWEVER subsequently opening a text file under a Microsoft o/s may
cause a conversion of line ends....Depends on the software you use.

You could try ZIPing or otherwise converting the ascii files into
binary before FTPing them and then deconverting them at the other end,
eg use GZIP to extract the HTML files, that should (<g> ) preserve the
file contents and size.

Matt
--
The Probert Encyclopaedia
Better, faster, prettier, than it was before
http://www.probertencyclopaedia.com

Dylan Parry

2006-09-24, 6:59 pm

ship wrote:

> Please can someone explain to me when to use ASCII and when to use
> BINARY for FTP!


I've always let my FTP client decide this for me. I don't think[1] I've
had any problems with taking this approach.

_______
[1] By this I mean I haven't noticed any problems or had any brought to
my attention.

--
Dylan Parry
http://electricfreedom.org | http://webpageworkshop.co.uk

Programming, n: A pastime similar to banging one's head
against a wall, but with fewer opportunities for reward.
GreyWyvern

2006-09-24, 6:59 pm

And lo, Mark Goodge didst speak in alt.www.webmaster:

> On 20 Sep 2006 03:05:05 -0700, ship put finger to keyboard and typed:
>
>
> Simple: ASCII for text files (including HTML, Perl, PHP, CSS and ASP
> files) and binary for binary files (including images, audio and pdf).


It could be simpler, IMHO. First, I'd recommend finding out what type of
server your site is running on. Next, find and use an editor which can
understand (and save in) the various line ending formats, and then always
transmit in binary.

What's on my local computer is exactly what's on the remote computer. I
can't remember the last time I worried about the FTP transfer type, except
to set it as the default.
[color=darkred]

This is likely because you are sending ASCII files with Windows line
endings (CR+LF) into a *nix line-ending environment (just LF). For some
setups, on the return, the CR's will automatically be translated to LF's,
which Windows will then automatically convert to CR+LF+CR+LF. (ACK!!)

Instead of Notepad, I've switched to Metapad which is almost the same
thing, except it automatically detects line endings, and allows you to
save in either "DOS" or "UNIX" types. I just edit all my files in the
UNIX type, since my server is on Linux, and transfer everything in
binary. Easy, clean, and less for me to worry about.

Grey

--
The technical axiom that nothing is impossible sinisterly implies the
pitfall corollary that nothing is ridiculous.
- http://www.greywyvern.com/orca#search - Orca Search: Full-featured
spider and site-search engine
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews