views:

35

answers:

1

Sometimes, when I upload files to ftp, and then download them, I face with some "unwanted tricks" inside gotten files.

Initial file:

<ul>
 <li><a href="#">Home</a></li>
 <li><a href="#">Works</a></li>
 <li><a href="#">About</a></li>
 <li><a href="#">Docs</a></li>
 <li><a href="#">Blog</a></li>
 <li><a href="#">Forums</a></li>
</ul>

2 examples:

1) Unwanted blank lines.

When I get files back, code becomes look like:

<ul>

 <li><a href="#">Home</a></li>

 <li><a href="#">Works</a></li>

 <li><a href="#">About</a></li>

 <li><a href="#">Docs</a></li>

 <li><a href="#">Blog</a></li>

 <li><a href="#">Forums</a></li>

</ul>

2) Tabulation clearing:

Code transforms to:

<ul><li><a href="#">Home</a></li><li><a href="#">Works</a></li><li><a href="#">About</a></li><li><a href="#">Docs</a></li><li><a href="#">Blog</a></li><li><a href="#">Forums</a></li></ul>

Why it happens and how to to beat these surprises?

+2  A: 

Make sure your transfer type is correct. In other words, ASCII or auto.

leppie
or "binary" is likely just fine.
selbie
which one is correct and beats these suprises?
Happy
why it happens?
Happy
@selbie: Yup, "binary" means "no messing around with the content"; otherwise FTP may try to "fix" your endlines and other whitespace. Note also that you need to set the "binary" mode for the connection both when uploading and downloading (unless it's the same connection).This is an artifact of the ancient and venerable FTP protocol; ASCII mode allows the FTP server to change the endlines of the file, thus maintaining some compatibility between Linux's LF, Windows' CRLF and Mac's CR; however, this can also lead to absolute havoc when the server guesses wrong.
Piskvor