Decode the HTML source when displaying it in EWW
* lisp/net/eww.el (eww-view-source): Decode the HTML source according to its headers.
This commit is contained in:
parent
b3d065d2ef
commit
0f7334147d
1 changed files with 9 additions and 0 deletions
|
@ -564,6 +564,15 @@ Currently this means either text/html or application/xhtml+xml."
|
|||
(delete-region (point-min) (point-max))
|
||||
(insert (or source "no source"))
|
||||
(goto-char (point-min))
|
||||
;; Decode the source and set the buffer's encoding according
|
||||
;; to what the HTML source specifies in its 'charset' header,
|
||||
;; if any.
|
||||
(let ((cs (find-auto-coding "" (point-max))))
|
||||
(when (consp cs)
|
||||
(setq cs (car cs))
|
||||
(when (coding-system-p cs)
|
||||
(decode-coding-region (point-min) (point-max) cs)
|
||||
(setq buffer-file-coding-system last-coding-system-used))))
|
||||
(when (fboundp 'html-mode)
|
||||
(html-mode))))
|
||||
(view-buffer buf)))
|
||||
|
|
Loading…
Add table
Reference in a new issue