Function: nnrss-get-encoding

nnrss-get-encoding is a byte-compiled function defined in nnrss.el.gz.

Signature

(nnrss-get-encoding)

Documentation

Return an encoding attribute specified in the current xml contents.

If nnrss-compatible-encoding-alist specifies the compatible encoding, it is used instead. If the xml contents doesn't specify the encoding, return utf-8 which is the default encoding for xml if it is available, otherwise return nil.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnrss.el.gz
;;; Internal functions
(defun nnrss-get-encoding ()
  "Return an encoding attribute specified in the current xml contents.
If `nnrss-compatible-encoding-alist' specifies the compatible encoding,
it is used instead.  If the xml contents doesn't specify the encoding,
return `utf-8' which is the default encoding for xml if it is available,
otherwise return nil."
  (goto-char (point-min))
  (if (re-search-forward
       "<\\?[^>]*encoding=\\(?:\"\\([^\">]+\\)\"\\|'\\([^'>]+\\)'\\)"
       nil t)
      (let ((encoding (intern (downcase (or (match-string 1)
					    (match-string 2))))))
	(or
	 (mm-coding-system-p (cdr (assq encoding
					nnrss-compatible-encoding-alist)))
	 (mm-coding-system-p encoding)
	 (mm-coding-system-p (car (rassq encoding
					 nnrss-compatible-encoding-alist)))))
    (mm-coding-system-p 'utf-8)))