How does the software decides if a file is binary or text ?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
johnkoenig90
New Member
New Member
Posts: 1
Joined: 2005-12-07, 01:38 UTC

How does the software decides if a file is binary or text ?

Post by *johnkoenig90 »

I have a file I'm copying from a unix box to a windows one. It's a plain text file with each line 1500 bytes long. For some strange reason, when the file transfer starts (in text mode), I get the message : "Warning. You try to transfer a binary file in text mode." But, the file IS simple text. Basically, it's just a long line full of numbers. My question is then : Based on what criteria does the software issue that warning ?
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

TC tries to guess by the content of the file (I do not know the exact algorithm). But usuallly it fails rarely.

But anyway, if you know you transfer a textfile you should use the Text-mode (as you already did) and simply ignore this warning.

As you probably know leads transferring a binary file in text mode possibly to a damaged file, because TC 'converts' some chars while transferring (e.g Linfeed+Carriage return to only linefeed vice versa).

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
User avatar
Hacker
Moderator
Moderator
Posts: 13068
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

IIRC TC checks the first 32K for a 0x00 char.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

In fact, TC looks for characters between 0 and 5, which shouldn't occur in normal text files. If you don't want this check, you can disable it with the line
WarnWrongMode=0

in wcx_ftp.ini in section [General].
Author of Total Commander
https://www.ghisler.com
Post Reply