Function: mm-find-charset-region

mm-find-charset-region is a byte-compiled function defined in mm-util.el.gz.

Signature

(mm-find-charset-region B E)

Documentation

Return a list of Emacs charsets in the region B to E.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/mm-util.el.gz
(defun mm-find-charset-region (b e)
  "Return a list of Emacs charsets in the region B to E."
  (cond
   (enable-multibyte-characters
    ;; Remove composition since the base charsets have been included.
    ;; Remove eight-bit-*, treat them as ascii.
    (let ((css (find-charset-region b e)))
      (dolist (cs '(composition eight-bit-control eight-bit-graphic control-1))
	(setq css (delq cs css)))
      css))
   (t
    ;; We are in a unibyte buffer, so we futz around a bit.
    (save-excursion
      (save-restriction
	(narrow-to-region b e)
	(goto-char (point-min))
	(skip-chars-forward "\0-\177")
	(if (eobp)
	    '(ascii)
	  (let (charset)
	    (setq charset (car (last (assq 'charset
					   (assoc current-language-environment
						  language-info-alist)))))
	    (if (eq charset 'ascii) (setq charset nil))
	    (or charset
		(setq charset
		      (car (last (assq mail-parse-charset
				       mm-mime-mule-charset-alist)))))
	    (list 'ascii (or charset 'latin-iso8859-1)))))))))