unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19555: shr-urlify: undecoded URIs make help-echo unhelpful
@ 2015-01-10 12:17 Ivan Shmakov
  2015-01-10 16:48 ` Lars Magne Ingebrigtsen
  2015-01-11 20:49 ` Juri Linkov
  0 siblings, 2 replies; 4+ messages in thread
From: Ivan Shmakov @ 2015-01-10 12:17 UTC (permalink / raw)
  To: 19555

[-- 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)))

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-13 18:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-10 12:17 bug#19555: shr-urlify: undecoded URIs make help-echo unhelpful Ivan Shmakov
2015-01-10 16:48 ` Lars Magne Ingebrigtsen
2015-01-11 20:49 ` Juri Linkov
2015-01-13 18:15   ` Ivan Shmakov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).