From db5a34cae7ead2df3515f939b6cd6f1c1f889c2e Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Tue, 18 Jun 2013 09:29:20 +0000 Subject: [PATCH] lisp/gnus/eww.el (eww-detect-charset): Improve regexp; move backward --- lisp/gnus/ChangeLog | 4 ++++ lisp/gnus/eww.el | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 06c5a98c6bc..c96702260fc 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,7 @@ +2013-06-18 Katsumi Yamaoka + + * eww.el (eww-detect-charset): Improve regexp; move backward. + 2013-06-18 Glenn Morris * mm-decode.el (widget-convert-button): Autoload. diff --git a/lisp/gnus/eww.el b/lisp/gnus/eww.el index 36baf354100..3914f067185 100644 --- a/lisp/gnus/eww.el +++ b/lisp/gnus/eww.el @@ -64,18 +64,6 @@ (setq url (concat "http://" url))) (url-retrieve url 'eww-render (list url))) -(defun eww-detect-charset (html-p) - (let ((case-fold-search t) - (pt (point))) - (or (and html-p - (re-search-forward - "]*charset=\\([^\t\n\r \"/>]+\\)" nil t) - (goto-char pt) - (match-string 1)) - (and (looking-at - "[\t\n\r ]*<\\?xml[\t\n\r ]+[^>]*encoding=\"\\([^\"]+\\)") - (match-string 1))))) - (defun eww-render (status url &optional point) (let ((redirect (plist-get status :redirect))) (when redirect @@ -128,6 +116,18 @@ (forward-line 1)) headers)) +(defun eww-detect-charset (html-p) + (let ((case-fold-search t) + (pt (point))) + (or (and html-p + (re-search-forward + "]*charset=\"?\\([^\t\n\r \"/>]+\\)" nil t) + (goto-char pt) + (match-string 1)) + (and (looking-at + "[\t\n\r ]*<\\?xml[\t\n\r ]+[^>]*encoding=\"\\([^\"]+\\)") + (match-string 1))))) + (defun eww-display-html (charset url) (unless (eq charset 'utf8) (decode-coding-region (point) (point-max) charset)) -- 2.39.2