Function: rfc2047-charset-to-coding-system

rfc2047-charset-to-coding-system is a byte-compiled function defined in rfc2047.el.gz.

Signature

(rfc2047-charset-to-coding-system CHARSET &optional ALLOW-OVERRIDE)

Documentation

Return coding-system corresponding to MIME CHARSET.

If your Emacs implementation can't decode CHARSET, return nil.

If allow-override is given, use mm-charset-override-alist to map undesired charset names to their replacement. This should only be used for decoding, not for encoding.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/rfc2047.el.gz
(defun rfc2047-charset-to-coding-system (charset &optional allow-override)
  "Return coding-system corresponding to MIME CHARSET.
If your Emacs implementation can't decode CHARSET, return nil.

If allow-override is given, use `mm-charset-override-alist' to
map undesired charset names to their replacement.  This should
only be used for decoding, not for encoding."
  (when (stringp charset)
    (setq charset (intern (downcase charset))))
  (when (or (not charset)
	    (eq 'gnus-all mail-parse-ignored-charsets)
	    (memq 'gnus-all mail-parse-ignored-charsets)
	    (memq charset mail-parse-ignored-charsets))
    (setq charset mail-parse-charset))
  (let ((cs (mm-charset-to-coding-system charset nil allow-override)))
    (cond ((eq cs 'ascii)
	   (setq cs (or (mm-charset-to-coding-system mail-parse-charset)
			'raw-text)))
	  ((mm-coding-system-p cs))
	  ((and charset
		(listp mail-parse-ignored-charsets)
		(memq 'gnus-unknown mail-parse-ignored-charsets))
	   (setq cs (mm-charset-to-coding-system mail-parse-charset))))
    (if (eq cs 'ascii)
	'raw-text
      cs)))