From: Ivan Shmakov <ivan@siamics.net>
To: 19555@debbugs.gnu.org
Subject: bug#19555: shr-urlify: undecoded URIs make help-echo unhelpful
Date: Sat, 10 Jan 2015 12:17:33 +0000 [thread overview]
Message-ID: <87zj9q25k2.fsf@violet.siamics.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]
Package: emacs
Severity: minor
As of 88bc8332eb14 (2015-01-07 13:51:41 +0000), shr-urlify
stores an undecoded URI as the link text’s 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%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
instead of the (arguably) much more readable:
https://ru.wikipedia.org/wiki/Фонд_свободного_программного_обеспечения
Since 2014-11-19, I use the code MIMEd to use the decoded string
for help-echo instead, – yet I doubt the code’s correctness.
For one thing, I’m pretty sure that I’ve seen non-UTF-8 codings
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.)
--
FSF associate member #7257 np. Brighter Than a Thousand Suns — Iron Maiden
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/diff, Size: 551 bytes --]
--- 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)))
next reply other threads:[~2015-01-10 12:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-10 12:17 Ivan Shmakov [this message]
2015-01-10 16:48 ` bug#19555: shr-urlify: undecoded URIs make help-echo unhelpful Lars Magne Ingebrigtsen
2015-01-11 20:49 ` Juri Linkov
2015-01-13 18:15 ` Ivan Shmakov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zj9q25k2.fsf@violet.siamics.net \
--to=ivan@siamics.net \
--cc=19555@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.