Commit 029788db authored by Lars Magne Ingebrigtsen's avatar Lars Magne Ingebrigtsen
Browse files

Fix `eww-display-html' bug when passed an explicit DOM

(eww-display-html): Don't try to decode the text if we've been
passed in a pre-parsed DOM.
parent 13375c13
......@@ -5,6 +5,8 @@
(eww-readable): Decode the saved text correctly.
(eww-readable): Save the history before displaying so that we can
go back to the non-readable version.
(eww-display-html): Don't try to decode the text if we've been
passed in a pre-parsed DOM.
2014-11-02 Lars Magne Ingebrigtsen <larsi@gnus.org>
......
......@@ -256,16 +256,18 @@ word(s) will be searched for via `eww-search-prefix'."
(defun eww-display-html (charset url &optional document point)
(or (fboundp 'libxml-parse-html-region)
(error "This function requires Emacs to be compiled with libxml2"))
(unless (eq charset 'utf-8)
(condition-case nil
(decode-coding-region (point) (point-max) charset)
(coding-system-error nil)))
(let ((document
(or document
(list
'base (list (cons 'href url))
(libxml-parse-html-region (point) (point-max)))))
(source (buffer-substring (point) (point-max))))
(progn
(unless (eq charset 'utf-8)
(condition-case nil
(decode-coding-region (point) (point-max) charset)
(coding-system-error nil)))
(libxml-parse-html-region (point) (point-max))))))
(source (and (null document)
(buffer-substring (point) (point-max)))))
(eww-setup-buffer)
(setq eww-current-source source
eww-current-dom document)
......
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