|
|
ru.perl- RU.PERL ---------------------------------------------------------------------- From : Dmitry Smolin 2:5020/949 19 Jan 2002 16:08:42 To : Andrey Titov Subject : Файл с русскими буквами - не текстовый. Почему? -------------------------------------------------------------------------------- Once, 19 Jan 2002 12:08, Andrey Titov wrote to All: AT> Когда файл test.htm содержит просто цифру 1, например, то всё AT> работает, а если какую-либо русскую букву (например, Ж), то проверка AT> файла не проходит, т.е. файл не распознаётся как текстовый. Блин, ну когда-нибудь документацию читать научимся? Или нет? === Cut === The "-T" and "-B" switches work as follows. The first block or so of the file is examined for odd characters such as strange control codes or _characters with the high bit set_. If too many strange characters (>30%) are found, it's a "-B" file, otherwise it's a "-T" file. Also, any file containing null in the first block is considered a binary file. If "-T" or "-B" is used on a filehandle, the current stdio buffer is examined rather than the first block. Both "-T" and "-B" return true on a null file, or a file at EOF when testing a filehandle. Because you have to read a file to do the "-T" test, on most occasions you want to use a "-f" against the file first, as in "next unless -f $file && -T $file". === Cut === Take care. --- skanking to the rhythm of the music by my side * Origin: This place is old, it feels just like a beat up truck (2:5020/949) Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.perl/208523c49622b.html, оценка из 5, голосов 10
|