1 |
;;; mm-encode.el --- Functions for encoding MIME things |
;;; mm-encode.el --- Functions for encoding MIME things |
2 |
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 |
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 |
3 |
;; Free Software Foundation, Inc. |
;; Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
36 |
'(("text/x-patch" 8bit) |
'(("text/x-patch" 8bit) |
37 |
("text/.*" qp-or-base64) |
("text/.*" qp-or-base64) |
38 |
("message/rfc822" 8bit) |
("message/rfc822" 8bit) |
39 |
("application/emacs-lisp" 8bit) |
("application/emacs-lisp" qp-or-base64) |
40 |
("application/x-emacs-lisp" 8bit) |
("application/x-emacs-lisp" qp-or-base64) |
41 |
("application/x-patch" 8bit) |
("application/x-patch" qp-or-base64) |
42 |
(".*" base64)) |
(".*" base64)) |
43 |
"Alist of regexps that match MIME types and their encodings. |
"Alist of regexps that match MIME types and their encodings. |
44 |
If the encoding is `qp-or-base64', then either quoted-printable |
If the encoding is `qp-or-base64', then either quoted-printable |
45 |
or base64 will be used, depending on what is more efficient." |
or base64 will be used, depending on what is more efficient. |
46 |
|
|
47 |
|
`qp-or-base64' has another effect. It will fold long lines so that |
48 |
|
MIME parts may not be broken by MTA. So do `quoted-printable' and |
49 |
|
`base64'. |
50 |
|
|
51 |
|
Note: It affects body encoding only when a part is a raw forwarded |
52 |
|
message (which will be made by `gnus-summary-mail-forward' with the |
53 |
|
arg 2 for example) or is neither the text/* type nor the message/* |
54 |
|
type. Even though in those cases, you can use the `encoding' MML tag |
55 |
|
to specify encoding of non-ASCII MIME parts." |
56 |
:type '(repeat (list (regexp :tag "MIME type") |
:type '(repeat (list (regexp :tag "MIME type") |
57 |
(choice :tag "encoding" |
(choice :tag "encoding" |
58 |
(const 7bit) |
(const 7bit) |
98 |
(defun mm-safer-encoding (encoding) |
(defun mm-safer-encoding (encoding) |
99 |
"Return an encoding similar to ENCODING but safer than it." |
"Return an encoding similar to ENCODING but safer than it." |
100 |
(cond |
(cond |
101 |
((memq encoding '(7bit 8bit quoted-printable)) 'quoted-printable) |
((eq encoding '7bit) '7bit) ;; 7bit is considered safe. |
102 |
|
((memq encoding '(8bit quoted-printable)) 'quoted-printable) |
103 |
;; The remaining encodings are binary and base64 (and perhaps some |
;; The remaining encodings are binary and base64 (and perhaps some |
104 |
;; non-standard ones), which are both turned into base64. |
;; non-standard ones), which are both turned into base64. |
105 |
(t 'base64))) |
(t 'base64))) |