Network Working Group K. Moore Request for Comments: 1522 University of Tennessee Obsoletes: 1342 September 1993 Category: Standards TrackMIME (Multipurpose Internet Mail Extensions) Part Two: Message Header Extensions for Non-ASCII Text
1. Introduction
RFC 1521 describes a mechanism for denoting textual body parts which are coded in various character sets, as well as methods for encoding such body parts as sequences of printable ASCII characters. This memo describes similar techniques to allow the encoding of non-ASCII text in various portions of a RFC 822 [2] message header, in a manner which is unlikely to confuse existing message handling software.
Moore [Page 1]
RFC 1522 MIME Part Two September 1993
While it is unfortunate that these programs do not correctly interpret RFC 822 headers, to "break" these programs would cause severe operational problems for the Internet mail system. The extensions described in this memo therefore do not rely on little- used features of RFC 822.
Moore [Page 2]
RFC 1522 MIME Part Two September 1993 2. Syntax of encoded-wordsAn "encoded-word" is defined by the following ABNF grammar. The notation of RFC 822 is used, with the exception that white space characters MAY NOT appear between components of an encoded-word.
Moore [Page 3]
RFC 1522 MIME Part Two September 1993 3. Character setsThe "charset" portion of an encoded-word specifies the character set associated with the unencoded text. A charset can be any of the character set names allowed in an RFC 1521 "charset" parameter of a "text/plain" body part, or any character set name registered with IANA for use with the MIME text/plain content-type [3]. (See section 7.1.1 of RFC 1521 for a list of charsets defined in that document).
4. Encodings
Initially, the legal values for "encoding" are "Q" and "B". These encodings are described below. The "Q" encoding is recommended for use when most of the characters to be encoded are in the ASCII character set; otherwise, the "B" encoding should be used. Nevertheless, a mail reader which claims to recognize encoded-words MUST be able to accept either encoding for any character set which it supports.
Moore [Page 4]
RFC 1522 MIME Part Two September 1993 4.1. The "B" encodingThe "B" encoding is identical to the "BASE64" encoding defined by RFC 1521.
4.2. The "Q" encoding
The "Q" encoding is similar to the "Quoted-Printable" content- transfer-encoding defined in RFC 1521. It is designed to allow text containing mostly ASCII characters to be decipherable on an ASCII terminal without decoding.
5. Use of encoded-words in message headers
An encoded-word may appear in a message header or body part header according to the following rules:
Moore [Page 5]
RFC 1522 MIME Part Two September 1993
(2) An encoded-word may appear within a comment delimited by "(" and ")", i.e., wherever a "ctext" is allowed. More precisely, the RFC 822 ABNF definition for "comment" is amended as follows:
Moore [Page 6]
RFC 1522 MIME Part Two September 1993 6. Support of encoded-words by mail readers 6.1. Recognition of encoded-words in message headersA mail reader must parse the message and body part headers according to the rules in RFC 822 to correctly recognize encoded-words.
6.2. Display of encoded-words
Any encoded-words so recognized are decoded, and if possible, the resulting unencoded text is displayed in the original character set.
Moore [Page 7]
RFC 1522 MIME Part Two September 1993
If the mail reader does not support the character set used, it may (a) display the encoded-word as ordinary text (i.e., as it appears in the header), (b) make a "best effort" to display using such characters as are available, or (c) substitute an appropriate message indicating that the decoded text could not be displayed.
6.3. Mail reader handling of incorrectly formed encoded-words
It is possible that an encoded-word that is legal according to the syntax defined in section 2, is incorrectly formed according to the rules for the encoding being used. For example:
7. Conformance
A mail composing program claiming compliance with this specification MUST ensure that any string of non-white-space printable ASCII characters within a "*text" or "*ctext" that begins with "=?" and ends with "?=" be a valid encoded-word. ("begins" means: at the start of the field-body or immediately following linear-white-space; "ends" means: at the end of the field-body or immediately preceding linear-white-space.) In addition, any "word" within a "phrase" that begins with "=?" and ends with "?=" must be a valid encoded-word.
Moore [Page 8]
RFC 1522 MIME Part Two September 1993 8. ExamplesFrom: =?US-ASCII?Q?Keith_Moore?= <moore@cs.utk.edu> To: =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk> CC: =?ISO-8859-1?Q?Andr=E9_?= Pirard <PIRARD@vm1.ulg.ac.be> Subject: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=
9. References
[1] Borenstein N., and N. Freed, "MIME (Multipurpose Internet Mail
Moore [Page 9]
RFC 1522 MIME Part Two September 1993 10. Security ConsiderationsSecurity issues are not discussed in this memo.
11. Author's Address
Keith Moore University of Tennessee 107 Ayres Hall Knoxville TN 37996-1301