Network Working Group N. Borenstein
Request for Comments: 1523 Bellcore
Category: Informational September 1993
The text/enriched MIME Content-type
Borenstein [Page 1]
RFC 1523 A text/enriched MIME Content-type September 1993
The syntax of "text/enriched" is very simple. It represents text in a single character set -- US-ASCII by default, although a different character set can be specified by the use of the "charset" parameter. (The semantics of text/enriched in non-ASCII character sets are discussed later in this document.) All characters represent themselves, with the exception of the "<" character (ASCII 60), which is used to mark the beginning of a formatting command. Formatting instructions consist of formatting commands surrounded by angle brackets ("<>", ASCII 60 and 62). Each formatting command may be no more than 60 characters in length, all in US-ASCII, restricted to the alphanumeric and hyphen ("-") characters. Formatting commands may be preceded by a solidus ("/", ASCII 47), making them negations, and such negations must always exist to balance the initial opening commands. Thus, if the formatting command "<bold>" appears at some point, there must later be a "</bold>" to balance it. (NOTE: The 60 character limit on formatting commands does NOT include the "<", ">", or "/" characters that might be attached to such commands.)
Borenstein [Page 2]
RFC 1523 A text/enriched MIME Content-type September 1993
This is a single line
Borenstein [Page 3]
RFC 1523 A text/enriched MIME Content-type September 1993
Smaller -- causes the affected text to be in a smaller font.
Borenstein [Page 4]
RFC 1523 A text/enriched MIME Content-type September 1993
The center, flushleft, and flushright commands are mutually exclusive, and, when nested, the inner command takes precedence.
Borenstein [Page 5]
RFC 1523 A text/enriched MIME Content-type September 1993
Verbatim -- causes the affected text to be displayed without
Borenstein [Page 6]
RFC 1523 A text/enriched MIME Content-type September 1993
<bold><italic>the-text</bold></italic>
Borenstein [Page 7]
RFC 1523 A text/enriched MIME Content-type September 1993
If the character set specified by the charset parameter on the Content-type line is anything other than "US-ASCII", this means that the text being described by text/enriched formatting commands is in a non-ASCII character set. However, the commands themselves are still the same ASCII commands that are defined in this document. This creates an ambiguity only with reference to the "<" character, the octet with numeric value 60. In single byte character sets, such as the ISO-8859 family, this is not a problem; the octet 60 can be quoted by including it twice, just as for ASCII. The problem is more complicated, however, in the case of multi-byte character sets, where the octet 60 might appear at any point in the byte sequence for any of several characters.
Borenstein [Page 8]
RFC 1523 A text/enriched MIME Content-type September 1993
An expected common way that sophisticated mail programs will generate text/enriched data is as part of a multipart/alternative construct. For example, a mail agent that can generate enriched mail in ODA format can generate that mail in a more widely interoperable form by generating both text/enriched and ODA versions of the same data, e.g.:
Borenstein [Page 9]
RFC 1523 A text/enriched MIME Content-type September 1993
An Example
Borenstein [Page 10]
RFC 1523 A text/enriched MIME Content-type September 1993
Security Considerations
Borenstein [Page 11]
RFC 1523 A text/enriched MIME Content-type September 1993
Appendix A -- A Simple enriched-to-plain Translator in C
Borenstein [Page 12]
RFC 1523 A text/enriched MIME Content-type September 1993
paramct++;
{
if (!s1 || !s2) return (-1);
while (*s1 && *s2 && len > 0) {
if (*s1 != *s2 && (tolower(*s1) != *s2)) return(-
Borenstein [Page 13]
RFC 1523 A text/enriched MIME Content-type September 1993
1);
Borenstein [Page 14]
RFC 1523 A text/enriched MIME Content-type September 1993
6. The following commands from text/richtext have been REMOVED from text/enriched: <COMMENT>, <OUTDENT>, <OUTDENTRIGHT>, <SAMEPAGE>, <SUBSCRIPT>, <SUPERSCRIPT>, <HEADING>, <FOOTING>, <ISO-8859-[1-9]>, <US-ASCII>, <PARAGRAPH>, <SIGNATURE>, <NO-OP>, <LT>, <NL>, and <NP>.