From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Shmakov Newsgroups: gmane.emacs.bugs Subject: bug#20009: eww-render: misrecognizes XHTML (application/xhtml+xml) Date: Thu, 05 Mar 2015 19:45:50 +0000 Message-ID: <8761af1b4h.fsf@violet.siamics.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1425584847 21061 80.91.229.3 (5 Mar 2015 19:47:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Mar 2015 19:47:27 +0000 (UTC) To: 20009@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 05 20:47:16 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YTbjm-0006po-7c for geb-bug-gnu-emacs@m.gmane.org; Thu, 05 Mar 2015 20:47:14 +0100 Original-Received: from localhost ([::1]:53877 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTbjl-0007wZ-Nb for geb-bug-gnu-emacs@m.gmane.org; Thu, 05 Mar 2015 14:47:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTbjh-0007wE-N4 for bug-gnu-emacs@gnu.org; Thu, 05 Mar 2015 14:47:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTbjc-00043q-6z for bug-gnu-emacs@gnu.org; Thu, 05 Mar 2015 14:47:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37712) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTbja-00043N-3s for bug-gnu-emacs@gnu.org; Thu, 05 Mar 2015 14:47:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YTbjZ-00045W-UM for bug-gnu-emacs@gnu.org; Thu, 05 Mar 2015 14:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Mar 2015 19:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20009 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: submit@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.142558476315638 (code B ref -1); Thu, 05 Mar 2015 19:47:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Mar 2015 19:46:03 +0000 Original-Received: from localhost ([127.0.0.1]:36280 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YTbid-00044A-D0 for submit@debbugs.gnu.org; Thu, 05 Mar 2015 14:46:03 -0500 Original-Received: from fely.am-1.org ([78.47.74.50]:58110) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YTbia-00043b-Pm for submit@debbugs.gnu.org; Thu, 05 Mar 2015 14:46:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:Date:Sender:Subject:To:From; bh=bTn9m/eiGwnyNyIfIYfs7f1P4seZxhYbcGxxYAyQoQE=; b=T3J2UJ4EGFEOIKc+MKXyW8I0ny3rEmmYvXJ/VGklN53jGS1703X03256qG/usQzUPfvF60xGJzOg57whKGA2Wo1OZJEl446cCKqMV3gzWV54TridkfH66LCxlEZluOhtHKhFhuH9lClAXjj1QJoyFKQlj/F9Nfbq+/VtWgqJ56k=; Original-Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YTbiZ-0003Ej-2U for submit@debbugs.gnu.org; Thu, 05 Mar 2015 19:45:59 +0000 Original-Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YTbiR-0006No-Rx for submit@debbugs.gnu.org; Fri, 06 Mar 2015 02:45:51 +0700 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:100103 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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.) --=20 FSF associate member #7257 np. Memento Mori =E2=80=94 Kamelot =E2=80=A6 3= 013 B6A0 230E 334A --=-=-= Content-Type: text/diff Content-Disposition: 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)) --=-=-=--