Mercurial > emacs
diff lisp/gnus/mm-decode.el @ 111842:265c545c8f48
Decode extra numeric entities.
mm-util.el (mm-extra-numeric-entities): New variable.
mm-url.el (mm-url-decode-entities):
mm-decode.el (mm-shr): Use it to decode extra numeric entities.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Tue, 07 Dec 2010 05:06:56 +0000 |
parents | 3334777d733d |
children | 700b890dcfb5 |
line wrap: on
line diff
--- a/lisp/gnus/mm-decode.el Mon Dec 06 21:01:00 2010 -0500 +++ b/lisp/gnus/mm-decode.el Tue Dec 07 05:06:56 2010 +0000 @@ -1699,7 +1699,7 @@ (when handle (mm-with-part handle (buffer-string)))))) - shr-inhibit-images shr-blocked-images charset) + shr-inhibit-images shr-blocked-images charset char) (if (and (boundp 'gnus-summary-buffer) (buffer-name gnus-summary-buffer)) (with-current-buffer gnus-summary-buffer @@ -1714,13 +1714,25 @@ (narrow-to-region (point) (point)) (shr-insert-document (mm-with-part handle - (when (and charset - (setq charset (mm-charset-to-coding-system charset)) - (not (eq charset 'ascii))) - (insert (prog1 - (mm-decode-coding-string (buffer-string) charset) - (erase-buffer) - (mm-enable-multibyte)))) + (insert (prog1 + (if (and charset + (setq charset + (mm-charset-to-coding-system charset)) + (not (eq charset 'ascii))) + (mm-decode-coding-string (buffer-string) charset) + (mm-string-as-multibyte (buffer-string))) + (erase-buffer) + (mm-enable-multibyte))) + (goto-char (point-min)) + (setq case-fold-search t) + (while (re-search-forward + "&#\\(?:x\\([89][0-9a-f]\\)\\|\\(1[2-5][0-9]\\)\\);" nil t) + (when (setq char + (cdr (assq (if (match-beginning 1) + (string-to-number (match-string 1) 16) + (string-to-number (match-string 2))) + mm-extra-numeric-entities))) + (replace-match (char-to-string char)))) (libxml-parse-html-region (point-min) (point-max)))) (mm-handle-set-undisplayer handle