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#19555: shr-urlify: undecoded URIs make help-echo unhelpful Date: Sat, 10 Jan 2015 12:17:33 +0000 Message-ID: <87zj9q25k2.fsf@violet.siamics.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1420892300 28042 80.91.229.3 (10 Jan 2015 12:18:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 10 Jan 2015 12:18:20 +0000 (UTC) To: 19555@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 10 13:18:15 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 1Y9uze-0004PM-8q for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Jan 2015 13:18:14 +0100 Original-Received: from localhost ([::1]:54849 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9uzd-0002EK-G5 for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Jan 2015 07:18:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9uzY-0002Cv-J3 for bug-gnu-emacs@gnu.org; Sat, 10 Jan 2015 07:18:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y9uzV-0006pe-Ba for bug-gnu-emacs@gnu.org; Sat, 10 Jan 2015 07:18:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60423) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9uzT-0006oX-8D for bug-gnu-emacs@gnu.org; Sat, 10 Jan 2015 07:18:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Y9uzS-0007cD-O4 for bug-gnu-emacs@gnu.org; Sat, 10 Jan 2015 07:18: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: Sat, 10 Jan 2015 12:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19555 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: submit@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.142089226829249 (code B ref -1); Sat, 10 Jan 2015 12:18:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Jan 2015 12:17:48 +0000 Original-Received: from localhost ([127.0.0.1]:41556 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y9uzD-0007bh-Dg for submit@debbugs.gnu.org; Sat, 10 Jan 2015 07:17:47 -0500 Original-Received: from fely.am-1.org ([78.47.74.50]:48730) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y9uzA-0007bU-9U for submit@debbugs.gnu.org; Sat, 10 Jan 2015 07:17:45 -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=qv7XQvJAUN+VT2sFdf/gdMwzLDcFky1fOKaah5zXSbM=; b=dRL//K3BK2kWknkP37Nb/VKSKRsJXEVOD+ghYocjjSXHmiJy462bXDSxSMZ3s2uWZGSTsnrjQ7n9wOrs+Q+492fcsPAAzJdq9lI7KXGlbHWy6QbLakkW/22j2kIYOVbfHv+iL6XUsUQaRUefpWv5LColydx34wOBybBUoO5PpEQ=; 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 1Y9uz7-0000bp-GN for submit@debbugs.gnu.org; Sat, 10 Jan 2015 12:17:42 +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 1Y9uz0-0002Fl-Cs for submit@debbugs.gnu.org; Sat, 10 Jan 2015 19:17:34 +0700 X-Date: Sat, 10 Jan 2015 12:08:00 +0000 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:98167 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Package: emacs Severity: minor As of 88bc8332eb14 (2015-01-07 13:51:41 +0000), shr-urlify stores an undecoded URI as the link text=E2=80=99s help-echo property, while it should most probably use a decoded IRI string instead. The net effect is that, for instance, while TABbing over some Russian Wikipedia article, the user may stumble upon: https://ru.wikipedia.org/wiki/%D0%A4%D0%BE%D0%BD%D0%B4_%D1%81%D0%B2%D0%BE%D= 0%B1%D0%BE%D0%B4%D0%BD%D0%BE%D0%B3%D0%BE_%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%= B0%D0%BC%D0%BC%D0%BD%D0%BE%D0%B3%D0%BE_%D0%BE%D0%B1%D0%B5%D1%81%D0%BF%D0%B5= %D1%87%D0%B5%D0%BD%D0%B8%D1%8F instead of the (arguably) much more readable: https://ru.wikipedia.org/wiki/=D0=A4=D0=BE=D0=BD=D0=B4_=D1=81=D0=B2=D0=BE= =D0=B1=D0=BE=D0=B4=D0=BD=D0=BE=D0=B3=D0=BE_=D0=BF=D1=80=D0=BE=D0=B3=D1=80= =D0=B0=D0=BC=D0=BC=D0=BD=D0=BE=D0=B3=D0=BE_=D0=BE=D0=B1=D0=B5=D1=81=D0=BF= =D0=B5=D1=87=D0=B5=D0=BD=D0=B8=D1=8F Since 2014-11-19, I use the code MIMEd to use the decoded string for help-echo instead, =E2=80=93 yet I doubt the code=E2=80=99s correctnes= s. For one thing, I=E2=80=99m pretty sure that I=E2=80=99ve seen non-UTF-8 co= dings being used for %-encoded URIs, and this change does by no means takes that into account. Another concern is that in its current form, it /does/ decode %20s into blanks, invalidating the IRI. EWW should probably also use the decoded form while filing eww-data :url entry (subject to the concerns above.) --=20 FSF associate member #7257 np. Brighter Than a Thousand Suns =E2=80=94 Iro= n Maiden --=-=-= Content-Type: text/diff Content-Disposition: inline --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -894,7 +918,13 @@ defun shr-urlify (start url &optional title) (add-text-properties start (point) (list 'shr-url url - 'help-echo (if title (shr-fold-text (format "%s (%s)" url title)) url) + 'help-echo (let ((iri (or (with-demoted-errors + "shr-urlify: %s" + (decode-coding-string + (url-unhex-string url) + 'utf-8 t)) + url))) + (if title (format "%s (%s)" iri title) iri)) 'follow-link t 'mouse-face 'highlight 'keymap shr-map))) --=-=-=--