PlainText

Community Definitions

RFC1341 says:

Content-Type: "text/plain; charset=us-ascii"

The default character set is US-ASCII.

unicode.org says:

Computer-encoded text that consists only of a sequence of code points from a given standard, with no other formatting or structural information. Plain text interchange is commonly used between computer systems that do not share higher-level protocols.

PlainText documents can be considered to be WysiWyg? documents, because whatever you type is exactly what the reader will see, leaving room for different fonts. PlainText documents carry their own “markup” as the structure of the document itself.

Rendering clients must respect all whitespace (i.e. spaces, tabs, newlines, …)

Any markup needed within the document can only occur within lower 7-bits.

Some accepted (but not standardized) notations are:

hightlighting: _underscore_, /italic/, *bold*
page break: A long string of one character such as:  ----, Ctrl-l
hierarchy: indentation (TABs or SPACEs), COLON (:), parenthesis (), {}, []

Questions

Can PlainText documents ever contain non-printable and/or 8-bit characters?

As mentioned above, they can contain tabulators, spaces, carriage return, line feed and form feed (^L) characters, and all of them are “non-printable”. There are of course much more non-printable characters, and some of them can destroy the “WYSIWYG” nature of plain text documents, so there is a doubt here. As for 8-bit characters – no, us-ascii character set only contains the 7-bit characters.

How should the lines end in a PlainText documents? CR/LF, CR or LF?

Obviously different systems get this differently: Unix systems (including Linux) use a single LF (a.k.a. \n), Macintosh uses a single CR (a.k.a. \r) and DOS/Windows use a pair of characters, CRLF (a.k.a. \r\n). This is no good, because the systems have to speak to each other. That’s why the communication protocols (such as the PostOfficeProtocol) had to agree to a common standard, and most Internet text-based protocols will use the DOS way, CRLF – this can be then translated to system’s native convention.

Discussion

This is one take on the definition of PlainText. One can argue that introducing the notation for underline, bold, etc. already makes it a different format, based on plain text – after all, what’s the difference between this and HTML?

The unicode.org says:

RichText?. Also known as styled text. The result of adding information to plain text. Examples of information that can be added include font data, color, formatting information, phonetic annotations, interlinear text, and so on. The Unicode Standard does not address the representation of rich text. It is expected that systems and applications will implement proprietary forms of rich text. Some public forms of rich text are available (for example, ODA, HTML, and SGML). When everything except primary content is removed from rich text, only plain text should remain.

The difference is that anyone can look at the “surface” of a plain text document and learn to write similar markup. Much like anyone can look at a typical chalkboard and learn to write similar text, drawings, and mathematical equations.

Yes, I store information as plain text when at all possible. I consider HTML a kind of plain text format – while one will never learn to write it just looking at the “surface”, it’s fairly easy to look just a little under the surface.

PDF, MP3, MPEG, etc. are not plain text. How many movies does one need to watch before one can produce one’s one movie?

I think I would answer these questions slightly differently …

Can PlainText documents ever contain non-printable and/or 8-bit characters?

They can contain spaces and newlines, which are are “non-printable”. As for 8-bit characters – yes, as long as they are limited to the printable characters in ISO-8859-15, stored in either that or UTF8 Unicode. (But I would prefer no tabs).

How should the lines end in a PlainText documents? CR/LF, CR or LF?

Just try to be consistent in any one particular document, OK? A newline is a newline. All properly-written programs ignore the difference between various line-ends when reading plain text documents.


PlainLink PlainTextWiki Wiki:PlainText Wiki:PowerOfPlainText

David, could you please explain why ISO-8859-15? Thank you for the links, I happen to collect similar papers.

Why ISO-8859 rather than US-ASCII ? Because I think “mañana” and “München” are plain text words. And ISO-8859-1 was once the default character set for pages on the web.

Why ISO-8859-15 rather than my previous favorite ISO-8859-1 ? The ISO-8859-15 improves on ISO-8859-1, adding a euro symbol. (It also lost a couple of letters I never used anyway, and replaced them with a couple of letters I suspect I won’t use, either).

Why ISO-8859-15 rather than Unicode? Good question.

So how did the topic of “plain text” come up on Community Wiki? Something to do with PlainTalk?

Define external redirect: RichText WysiWyg

Languages: