in reply to File test -T (text) and quoted filenames

A text editor I used to use a lot had a simple heuristic to check if a file is a binary file: "Does it contain any null bytes (=bytes with character code 0)?". It worked very well in practice; but you'll have to be very careful with non-UTF-8 Unicode files...

Besides, AFAIK file tests like -T use the raw file name, spaces and all, as a parameter. So does 3 argument open. A peculiar exception is glob, for which a file pattern has to be quoted if it contains spaces.