From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: * X-Spam-Status: No, score=1.8 required=3.0 tests=BAYES_50,FORGED_GMAIL_RCVD, FREEMAIL_FROM,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.ada Subject: Re: Using "pure" (?) Ada, how to determine whether a file is a "text" file, not a binary? Date: Sat, 01 Jul 2023 14:39:02 -0700 Organization: None to speak of Message-ID: <87edlrxqfd.fsf@nosuchdomain.example.com> References: <41a5cad2-b5ca-4996-b057-e1ae8b27f526n@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: dont-email.me; posting-host="b7dd3dc39b8f7f61e15fc922c859854e"; logging-data="3196166"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19CBbBblSoW28ywY/mMbEI5" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:PikyfQR/sH29FJ3PSWhNrUfqFNI= sha1:tNEAWZCX7J0mOLO3sW6sSQvunXE= Xref: news.eternal-september.org comp.lang.ada:65396 List-Id: Kenneth Wolcott writes: > On Saturday, July 1, 2023 at 1:39:30 PM UTC-7, Jeffrey R.Carter wrote: >> On 2023-07-01 19:15, Kenneth Wolcott wrote: [...] >> For example, if a text file is one in which all the characters, except line >> terminators, are graphic characters, then it should be clear how to determine >> whether a file meets that definition of a text file. > > I think that is the definition that I'm going to pursue as the > simplest and effective definition. Think about how you want to handle tab characters (non-graphic but common in some text) and carriage return characters (non-graphic but part of a line terminator for Windows-style text files). Also think about the various ways of representing text: ASCII, Latin-1, UTF-8, UTF-16, etc. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */