A file contains text data and binary data ... Is it a text file or a binary file?

Doug Ewell doug at ewellic.org
Mon Sep 14 17:32:50 CDT 2020


Roger L Costello wrote:

> Based on the many potential problems you described with using a text
> editor to display a file that contains text data and binary data, I
> draw this conclusion: If a file contains binary data, it is a binary
> file; only if the file contains purely text data is it a text file."
> Do you agree with this conclusion?

Sure. I mean, it's as close as you're probably going to get.

I used a hex editor on a known text file just this morning. And POSIX definitions notwithstanding, there are text files with lines of arbitrary length, or in encodings that are not bytewise extensions of ASCII. So if you want a solid, one-sentence definition of "text" versus "binary" that covers all scenarios and doesn't take into account what humans would consider "text" and "not text," prepare for that one sentence to have a lot of clauses.

--
Doug Ewell, CC, ALB | Thornton, CO, US | ewellic.org






More information about the Unicode mailing list