GNU bug report logs -
#20009
eww-render: misrecognizes XHTML (application/xhtml+xml)
Previous Next
Reported by: Ivan Shmakov <ivan <at> siamics.net>
Date: Thu, 5 Mar 2015 19:47:01 UTC
Severity: minor
Tags: fixed, patch
Fixed in version 25.1
Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20009 in the body.
You can then email your comments to 20009 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20009
; Package
emacs
.
(Thu, 05 Mar 2015 19:47:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ivan Shmakov <ivan <at> siamics.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 05 Mar 2015 19:47:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Package: emacs
Severity: minor
Tags: patch
As currently implemented, EWW fails to properly render XHTML
documents, when served with Content-Type: application/xhtml+xml.
Consider, e. g.:
M-x eww RET http://www.x.org/releases/X11R7.7/doc/man/man1/index.xhtml RET
Please thus consider the patch MIMEd.
* lisp/net/eww.el (eww-html-p): New function.
(eww-render): Use it.
(Tested on 619fc5c197eb, 2015-02-26 18:09:48 UTC.)
--
FSF associate member #7257 np. Memento Mori — Kamelot … 3013 B6A0 230E 334A
[Message part 2 (text/diff, inline)]
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -300,6 +284,12 @@
(interactive "r")
(eww (buffer-substring beg end)))
+(defun eww-html-p (content-type)
+ "Return non-nil if CONTENT-TYPE designates an HTML content type.
+Currently this means either text/html or application/xhtml+xml."
+ (string-match-p "^\\(text\\|application\\)/\\(html\\|xhtml\\+xml\\)$"
+ content-type))
+
(defun eww-render (status url &optional point buffer encode)
(let ((redirect (plist-get status :redirect)))
(when redirect
@@ -318,8 +308,7 @@ defun eww-render (status url &optional point buffer encode)
(charset (intern
(downcase
(or (cdr (assq 'charset (cdr content-type)))
- (eww-detect-charset (equal (car content-type)
- "text/html"))
+ (eww-detect-charset (eww-html-p (car content-type)))
"utf-8"))))
(data-buffer (current-buffer)))
;; Save the https peer status.
@@ -332,7 +321,7 @@ defun eww-render (status url &optional point buffer encode)
(string-match-p eww-use-external-browser-for-content-type
(car content-type)))
(eww-browse-with-external-browser url))
- ((equal (car content-type) "text/html")
+ ((eww-html-p (car content-type))
(eww-display-html charset url nil point buffer encode))
((equal (car content-type) "application/pdf")
(eww-display-pdf))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20009
; Package
emacs
.
(Thu, 05 Mar 2015 22:28:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 20009 <at> debbugs.gnu.org (full text, mbox):
Ivan Shmakov <ivan <at> siamics.net> writes:
> * lisp/net/eww.el (eww-html-p): New function.
> (eww-render): Use it.
Thanks. I've applied a variant of your patch.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Magne Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 05 Mar 2015 22:28:03 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 25.1, send any further explanations to
20009 <at> debbugs.gnu.org and Ivan Shmakov <ivan <at> siamics.net>
Request was from
Lars Magne Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 05 Mar 2015 22:28:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 03 Apr 2015 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 130 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.