Download GNU Emacs Manual - Programming Systems Lab

Transcript
Chapter 28: Reading Mail with Rmail
310
other hand, if you use e after t, to edit the original (unreformatted) header, those changes
are permanent.
When the t command has a prefix argument, a positive argument means to show the
reformatted header, and a zero or negative argument means to show the full header.
When the terminal supports multiple fonts or colors, Rmail highlights certain header
fields that are especially interesting—by default, the ‘From’ and ‘Subject’ fields. The
variable rmail-highlighted-headers holds a regular expression that specifies the header
fields to highlight; if it matches the beginning of a header field, that whole field is highlighted.
If you specify unusual colors for your text foreground and background, the colors used for
highlighting may not go well with them. If so, specify different colors by setting the variable
rmail-highlight-face to a suitable face. To turn off highlighting entirely in Rmail, set
rmail-highlighted-headers to nil.
You can highlight and activate URLs in incoming messages by adding the function
goto-address to the hook rmail-show-message-hook. Then you can browse these URLs
by clicking on them with Mouse-2 (or Mouse-1 quickly) or by moving to one and typing
C-c RET. See Section 31.15.2 [Activating URLs], page 373.
28.14 Rmail and Coding Systems
Rmail automatically decodes messages which contain non-ASCII characters, just as
Emacs does with files you visit and with subprocess output. Rmail uses the standard
‘charset=charset ’ header in the message, if any, to determine how the message was
encoded by the sender. It maps charset into the corresponding Emacs coding system (see
Section 19.7 [Coding Systems], page 179), and uses that coding system to decode message
text. If the message header doesn’t have the ‘charset’ specification, or if charset is not
recognized, Rmail chooses the coding system with the usual Emacs heuristics and defaults
(see Section 19.8 [Recognize Coding], page 181).
Occasionally, a message is decoded incorrectly, either because Emacs guessed the wrong
coding system in the absence of the ‘charset’ specification, or because the specification was inaccurate. For example, a misconfigured mailer could send a message with a
‘charset=iso-8859-1’ header when the message is actually encoded in koi8-r. When you
see the message text garbled, or some of its characters displayed as empty boxes, this may
have happened.
You can correct the problem by decoding the message again using the right coding
system, if you can figure out or guess which one is right. To do this, invoke the M-x
rmail-redecode-body command. It reads the name of a coding system, encodes the message body using whichever coding system was used to decode it before, then redecodes it
using the coding system you specified. If you specified the right coding system, the result
should be readable.
Decoding and encoding using the wrong coding system is lossless for most encodings,
in particular with 8-bit encodings such as iso-8859 or koi8. So, if the initial attempt to
redecode the message didn’t result in a legible text, you can try other coding systems until
you succeed.
With some coding systems, notably those from the iso-2022 family, information can be
lost in decoding, so that encoding the message again won’t bring back the original incoming