summaryrefslogtreecommitdiff
path: root/lisp/gnus/mm-url.el
diff options
context:
space:
mode:
authorKatsumi Yamaoka <yamaoka@jpl.org>2010-12-07 05:06:56 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2010-12-07 05:06:56 +0000
commitc912b478a7752a75faa1790350421d084b71999b (patch)
treed8f6912b3e593b1c48084e051a8fadc2ec403e3c /lisp/gnus/mm-url.el
parent674c5ccf395d233eacf0fc07c36811d6f53114be (diff)
downloademacs-c912b478a7752a75faa1790350421d084b71999b.tar.gz
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.
Diffstat (limited to 'lisp/gnus/mm-url.el')
-rw-r--r--lisp/gnus/mm-url.el19
1 files changed, 11 insertions, 8 deletions
diff --git a/lisp/gnus/mm-url.el b/lisp/gnus/mm-url.el
index 0da136e1efc..0c2b80c9ca7 100644
--- a/lisp/gnus/mm-url.el
+++ b/lisp/gnus/mm-url.el
@@ -365,16 +365,19 @@ If FOLLOW-REFRESH is non-nil, redirect refresh url in META."
(defun mm-url-decode-entities ()
"Decode all HTML entities."
(goto-char (point-min))
- (while (re-search-forward "&\\(#[0-9]+\\|#x[0-9a-f]+\\|[a-z]+[0-9]*\\);" nil t)
+ (while (re-search-forward "&\\(#[0-9]+\\|#x[0-9a-f]+\\|[a-z]+[0-9]*\\);"
+ nil t)
(let* ((entity (match-string 1))
(elem (if (eq (aref entity 0) ?\#)
- (let ((c (mm-ucs-to-char
- ;; Hex number: &#x3212
- (if (eq (aref entity 1) ?x)
- (string-to-number (substring entity 2)
- 16)
- ;; Decimal number: &#23
- (string-to-number (substring entity 1))))))
+ (let ((c
+ ;; Hex number: &#x3212
+ (if (eq (aref entity 1) ?x)
+ (string-to-number (substring entity 2)
+ 16)
+ ;; Decimal number: &#23
+ (string-to-number (substring entity 1)))))
+ (setq c (or (cdr (assq c mm-extra-numeric-entities))
+ (mm-ucs-to-char c)))
(if (mm-char-or-char-int-p c) c ?#))
(or (cdr (assq (intern entity)
mm-url-html-entities))