comparison lisp/gnus/mm-bodies.el @ 70052:261c2dbe91d2

* mm-util.el (mm-charset-synonym-alist): Improve doc string. (mm-charset-override-alist): New variable. (mm-charset-to-coding-system): Use it. (mm-codepage-setup): New helper function. (mm-charset-eval-alist): New variable. (mm-charset-to-coding-system): Use mm-charset-eval-alist. Warn about unknown charsets. Add allow-override. Use `mm-charset-override-alist' only when decoding. (mm-detect-mime-charset-region): Use :mime-charset. * mm-bodies.el (mm-decode-body, mm-decode-string): Call `mm-charset-to-coding-system' with allow-override argument.
author Reiner Steib <Reiner.Steib@gmx.de>
date Mon, 17 Apr 2006 19:37:15 +0000
parents dbc43cabc13b
children e3694f1cb928 72dea2ff0142
comparison
equal deleted inserted replaced
70051:700b1f9b81e2 70052:261c2dbe91d2
54 (iso-2022-jp-2 . 7bit) 54 (iso-2022-jp-2 . 7bit)
55 ;; We MUST encode UTF-16 because it can contain \0's which is 55 ;; We MUST encode UTF-16 because it can contain \0's which is
56 ;; known to break servers. 56 ;; known to break servers.
57 ;; Note: UTF-16 variants are invalid for text parts [RFC 2781], 57 ;; Note: UTF-16 variants are invalid for text parts [RFC 2781],
58 ;; so this can't happen :-/. 58 ;; so this can't happen :-/.
59 ;; PPS: Yes, it can happen if the user specifies UTF-16 in the MML
60 ;; markup. - jh.
59 (utf-16 . base64) 61 (utf-16 . base64)
60 (utf-16be . base64) 62 (utf-16be . base64)
61 (utf-16le . base64)) 63 (utf-16le . base64))
62 "Alist of MIME charsets to encodings. 64 "Alist of MIME charsets to encodings.
63 Valid encodings are `7bit', `8bit', `quoted-printable' and `base64'." 65 Valid encodings are `7bit', `8bit', `quoted-printable' and `base64'."
249 (save-excursion 251 (save-excursion
250 (when encoding 252 (when encoding
251 (mm-decode-content-transfer-encoding encoding type)) 253 (mm-decode-content-transfer-encoding encoding type))
252 (when (and (featurep 'mule) ;; Fixme: Wrong test for unibyte session. 254 (when (and (featurep 'mule) ;; Fixme: Wrong test for unibyte session.
253 (not (eq charset 'gnus-decoded))) 255 (not (eq charset 'gnus-decoded)))
254 (let ((coding-system (mm-charset-to-coding-system charset))) 256 (let ((coding-system (mm-charset-to-coding-system
257 ;; Allow overwrite using
258 ;; `mm-charset-override-alist'.
259 charset nil t)))
255 (if (and (not coding-system) 260 (if (and (not coding-system)
256 (listp mail-parse-ignored-charsets) 261 (listp mail-parse-ignored-charsets)
257 (memq 'gnus-unknown mail-parse-ignored-charsets)) 262 (memq 'gnus-unknown mail-parse-ignored-charsets))
258 (setq coding-system 263 (setq coding-system
259 (mm-charset-to-coding-system mail-parse-charset))) 264 (mm-charset-to-coding-system mail-parse-charset)))
280 (memq 'gnus-all mail-parse-ignored-charsets) 285 (memq 'gnus-all mail-parse-ignored-charsets)
281 (memq charset mail-parse-ignored-charsets)) 286 (memq charset mail-parse-ignored-charsets))
282 (setq charset mail-parse-charset)) 287 (setq charset mail-parse-charset))
283 (or 288 (or
284 (when (featurep 'mule) 289 (when (featurep 'mule)
285 (let ((coding-system (mm-charset-to-coding-system charset))) 290 (let ((coding-system (mm-charset-to-coding-system
291 charset
292 ;; Allow overwrite using
293 ;; `mm-charset-override-alist'.
294 nil t)))
286 (if (and (not coding-system) 295 (if (and (not coding-system)
287 (listp mail-parse-ignored-charsets) 296 (listp mail-parse-ignored-charsets)
288 (memq 'gnus-unknown mail-parse-ignored-charsets)) 297 (memq 'gnus-unknown mail-parse-ignored-charsets))
289 (setq coding-system 298 (setq coding-system
290 (mm-charset-to-coding-system mail-parse-charset))) 299 (mm-charset-to-coding-system mail-parse-charset)))