ArticleslgStudy

science

Plain text

Plain text is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Plain text rather than just read about it. In short: In computing, plain text is a loose term for unformatted text or nontextual data represented as text (e.g. file contents) using printable characters (for example letters, digits, symbols, spaces, tabs, line breaks) in a character encoding. In principle, plain text can be in any encoding, but today usually implies UTF-8.

Plain text — main illustration
Plain text — illustration

Key takeaways

  • Plain text belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Plain text to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Plain text from memory before moving on to harder problems.

Reference excerpt

In computing, plain text is a loose term for unformatted text or nontextual data represented as text (e.g. file contents) using printable characters (for example letters, digits, symbols, spaces, tabs, line breaks) in a character encoding. In principle, plain text can be in any encoding, but today usually implies UTF-8. Plain text is different from formatted text, where style information is included; from structured text, where structural parts of the document such as paragraphs, sections, and the like are identified; and from binary files in which some portions must be interpreted as binary objects (encoded integers, real numbers, images, etc.). Plain text is often used as a counterpiece to "binary" files: those in which at least some parts of the file cannot be correctly interpreted as text. For example, a file or string consisting of "hello", following by 4 bytes that express a binary integer that is supposed to be evaluated in a CPU representation like little endian, is a binary file. Text files that do not represent anything but text in a character encoding have no indicator of encoding, no magic number, no special marker at the beginning and no metadata marking them as text in most file systems. However their file-names are often marked with .txt at the end by Windows users and other operating systems often assume unidentifiable files to be text. However there is the MIME type "text/plain" that is used for transfer over the internet or between software components.

Plain text and rich text According to The Unicode Standard:

"Plain text is a pure sequence of character codes; plain Unicode-encoded text is therefore a sequence of Unicode character codes. In contrast, styled text, also known as rich text, is any text representation containing plain text plus added information such as a language identifier, font size, color, hypertext links, and so on. SGML, RTF, HTML, XML, and TeX are examples of rich text fully represented as plain text streams, interspersing plain text data with sequences of characters that represent the additional data structures." According to other definitions, however, files that contain markup or other meta-data are generally considered plain text, so long as the markup is also in a directly human-readable form (as in HTML, XML, and so on). Thus, representations such as SGML, RTF, HTML, XML, wiki markup, and TeX, as well as nearly all programming language source code files, are considered plain text. The particular content is irrelevant to whether a file is plain text. For example, an SVG file can express drawings or even bitmapped graphics, but is still plain text. The use of plain text rather than binary files enables files to survive much better "in the wild", in part by making them largely immune to computer architecture incompatibilities. For example, with all data encoded as UTF-8 text, all the problems of endianness can be avoided.

Usage One purpose of using plain text today is independence from programs that require proprietary encodings or a file format. Plain text files can be opened, read, and edited with standard text editors and utilities. A command-line interface allows people to give commands in plain text and get a response, also typically in plain text. Many other computer programs are also capable of processing or creating plain text, such as countless programs in DOS, Windows, classic Mac OS, and Unix and its kin; as well as web browsers (a few browsers such as Lynx and the Line Mode Browser produce only plain text for display) and other e-text readers. Plain text files are almost universal in programming; a source code file containing instructions in a programming language is almost always a plain text file. Plain text is also commonly used for configuration files, which are read for saved settings at the startup of a program. Plain text is used for much e-mail. A comment, a ".txt" file, or a TXT Record generally contains only plain text (without formatting) intended for humans to read.

Encoding

Character encodings

Before the early 1960s, computers were mainly used for number-crunching rather than for text, and memory was extremely expensive. Computers often allocated only 6 bits for each character, permitting only 64 characters—assigning codes for A-Z, a-z, and 0-9 would leave only 2 codes: nowhere near enough. Most computers opted not to support lower-case letters. Thus, early text projects such as Roberto Busa's Index Thomisticus, the Brown Corpus, and others had to resort to conventions such as keying an asterisk preceding letters actually intended to be upper-case. Fred Brooks of IBM argued strongly for going to 8-bit bytes, because someday people might want to process text, and won. Although IBM used EBCDIC, most text from then on came to be encoded in ASCII, using values from 0 to 31 for (non-printing) control characters, and values from 32 to 127 for graphic characters such as letters, digits, and punctuation. Most machines stored characters in 8 bits rather than 7, ignoring the remaining bit or using it as a checksum. When a document is received without any explicit indication of the character encoding, some applications use charset detection to attempt to guess what encoding was used.

See also Binary data Binary file Binary protocol Source code Text file Text-based protocol Line wrap and word wrap

References

Illustrations

Plain text: Text file with portion of The Human Side of Animals by Royal Dixon, displayed by the command cat in an xterm window
Text file with portion of The Human Side of Animals by Royal Dixon, displayed by the command cat in an xterm window

Worked examples

Example 1 — a first encounter with Plain text

Start with the simplest possible case. Write down what Plain text claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Plain text before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Plain text ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Plain text

In research
Plain text appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Plain text in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Plain text is common in secondary-school and first-year university syllabi. It links to neighbouring topics Open formats, Text file formats, so understanding it makes those chapters shorter.
In everyday life
Look for Plain text outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Plain text” →

How to study Plain text in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Plain text means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Plain text out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Plain text in simple terms?

In computing, plain text is a loose term for unformatted text or nontextual data represented as text (e.g. file contents) using printable characters (for example letters, digits, symbols, spaces, tabs, line breaks) in a character encoding. In principle, plain text can be in any encoding, but today…

Why does Plain text matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Plain text?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Plain text.

Tags

  • Open formats
  • Text file formats

Keep exploring