in reply to determining Binary file
If a bona-fide text file happens to contain mostly non-ASCII utf8 characters, -B (in perl 5.8.x) will correctly return "false" (not binary), even though nearly all the bytes in the file have their eighth bit set.
But if the same text data are stored in a file using a non-unicode character set (e.g. iso-8859-5, -6, -7 for Cyrillic, Arabic, Greek, respectively), -B returns "true". Most of the bytes have their 8th bit set, but they aren't parsable as utf8.
(I only had Arabic text on hand for the test, and used just 5.8.1 on macosx, but I trust that the result does extrapolate to other languages, later versions, and different OS's.)
|
|---|