Same file, different file size

Solution 1:

deadcow_seo.php uses Unix line endings (LF), while deadcow_seo.php_2.php uses DOS/Windows line endings (CR LF).

FTP has several "transfer modes", out of which two are in common use1binary (also called "image") and text (or "ASCII"). In "binary" mode the file is transferred exactly as it is, byte-by-byte, while "ASCII" causes the file to be interpreted as consisting of lines of text – the line endings are converted to the network standard CR LF when sending, and converted to the machine's native line endings when receiving.

Transferring files as text might make some sense at first, but it only causes trouble later – in fact, some FTP servers have removed it completely or make it equivalent to binary on the server side. Besides, most text editors (excluding Notepad) can read and save files in both Windows and Unix formats.

Just configure your FTP client to always use binary mode – the command is usually bin or mode i, while graphical clients might have a checkbox or a file type list in their settings.


1 Some old modes are "tenex" (long obsolete, for TENEX page-based files) and "compressed" (which appears to be defined as a simple RLE algorithm). Recent FTP servers support "mode z" for zlib compression.

Solution 2:

You used text (or ASCII) transfer mode, which replaces line breaks during the transfer. This is often useful for when you develop scripts and programs on Windows and transfer the files to Linux or Mac OS X. They simply won't work otherwise, since the system sees garbage data at the end of every line.

If the file has a single Windows line break, \r\n (or CRLF), and you downloaded to Linux or Mac OS X, it was replaced by \n (or LF), which is 1 byte less. Using FileMerge to compare the files confirms this in the status bar:

enter image description here

Also see this answer on data interpretation.


You can configure which file types are interpreted as text in Transmit's preferences:

enter image description here

You can remove all file extensions from this list, and just standardize on Linux/Mac OS X line breaks, i.e. \n, even when using Windows. Most editors are capable to change the line ending mode.