Commit db5a34ca authored by Katsumi Yamaoka's avatar Katsumi Yamaoka

lisp/gnus/eww.el (eww-detect-charset): Improve regexp; move backward

parent 9a08a617
2013-06-18 Katsumi Yamaoka <yamaoka@jpl.org>
* eww.el (eww-detect-charset): Improve regexp; move backward.
2013-06-18 Glenn Morris <rgm@gnu.org> 2013-06-18 Glenn Morris <rgm@gnu.org>
* mm-decode.el (widget-convert-button): Autoload. * mm-decode.el (widget-convert-button): Autoload.
......
...@@ -64,18 +64,6 @@ ...@@ -64,18 +64,6 @@
(setq url (concat "http://" url))) (setq url (concat "http://" url)))
(url-retrieve url 'eww-render (list 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
"<meta[\t\n\r ]+[^>]*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) (defun eww-render (status url &optional point)
(let ((redirect (plist-get status :redirect))) (let ((redirect (plist-get status :redirect)))
(when redirect (when redirect
...@@ -128,6 +116,18 @@ ...@@ -128,6 +116,18 @@
(forward-line 1)) (forward-line 1))
headers)) headers))
(defun eww-detect-charset (html-p)
(let ((case-fold-search t)
(pt (point)))
(or (and html-p
(re-search-forward
"<meta[\t\n\r ]+[^>]*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) (defun eww-display-html (charset url)
(unless (eq charset 'utf8) (unless (eq charset 'utf8)
(decode-coding-region (point) (point-max) charset)) (decode-coding-region (point) (point-max) charset))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment