A mail reader must parse the message and body part headers according
to the rules in RFC 822 to correctly recognize encoded-words.
Encoded-words are to be recognized as follows:
- Any message or body part header field defined as "*text", or any
user-defined header field, should be parsed as follows: Beginning
at the start of the field-body and immediately following each
occurrence of linear-white-space, each sequence of up to 75
printable characters (not containing any linear-white-space)
should be examined to see if it is an encoded-word according to
the syntax rules in section 2.
Any other sequence of printable
characters should be treated as ordinary ASCII text.
- Any header field not defined as "*text" should be parsed
according to the syntax rules for that header field. However,
any "word" that appears within a "phrase" should be treated as an
encoded-word if it meets the syntax rules in
section 2.
Otherwise it should be treated as an ordinary "word".
- Within a "comment", any sequence of up to 75 printable characters
(not containing linear-white-space), that meets the syntax rules
in section 2, should be treated as an encoded-word. Otherwise it
should be treated as normal comment text.
Any encoded-words so recognized are decoded, and if possible, the
resulting unencoded text is displayed in the original character set.
When displaying a particular header field that contains multiple
encoded-words, any linear-white-space that separates a pair of
adjacent encoded-words is ignored. (This is to allow the use of
multiple encoded-words to represent long strings of unencoded text,
without having to separate encoded-words where spaces occur in the
unencoded text.)
In the event other encodings are defined in the future, and the mail
reader does not support the encoding used, it may either (a) display
the encoded-word as ordinary text, or (b) substitute an appropriate
message indicating that the text could not be decoded.
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.
If the character set being used employs code-switching techniques,
display of the encoded text implicitly begins in "ASCII mode". In
addition, the mail reader must ensure that the output device is once
again in "ASCII mode" after the encoded-word is displayed.
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:
- An encoded-word which contains characters which are not legal for
a particular encoding (for example, a '-' in the "B" encoding),
is incorrectly formed.
- Any encoded-word which encodes a non-integral number of
characters or octets is incorrectly formed.
A mail reader need not attempt to display the text associated with an
encoded-word that is incorrectly formed. However, a mail reader MUST
NOT prevent the display or handling of a message because an encoded-
word is incorrectly formed.