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

* bug#19555: shr-urlify: undecoded URIs make help-echo unhelpful
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2015-01-10 16:48 UTC (permalink / raw)
  To: Ivan Shmakov; +Cc: 19555

Ivan Shmakov <ivan@siamics.net> writes:

> 	EWW should probably also use the decoded form while filing
> 	eww-data :url entry (subject to the concerns above.)

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#19555: shr-urlify: undecoded URIs make help-echo unhelpful
  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
  1 sibling, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2015-01-11 20:49 UTC (permalink / raw)
  To: Ivan Shmakov; +Cc: 19555

> 	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.

Firefox uses the preference network.standard-url.escape-utf8 to do the same:
http://kb.mozillazine.org/Network.standard-url.escape-utf8
and it was useful by set it to false, so I welcome this change, thanks.





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

* bug#19555: shr-urlify: undecoded URIs make help-echo unhelpful
  2015-01-11 20:49 ` Juri Linkov
@ 2015-01-13 18:15   ` Ivan Shmakov
  0 siblings, 0 replies; 4+ messages in thread
From: Ivan Shmakov @ 2015-01-13 18:15 UTC (permalink / raw)
  To: 19555

>>>>> Juri Linkov <juri@linkov.net> writes:

 >> 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.

 > Firefox uses the preference network.standard-url.escape-utf8 to do
 > the same: http://kb.mozillazine.org/Network.standard-url.escape-utf8
 > and it was useful by set it to false, so I welcome this change,
 > thanks.

	The change only affects the text displayed in the echo area when
	walking over the links (as in: shr-next-link, TAB), while the
	Firefox option above deals with copying of the URIs, – an
	equivalent to shr-copy-url (‘w’.)  Or perhaps G C-n in EWW, –
	assuming eww-links-at-point tops the eww-suggest-uris list.

	The latter is yet to be changed.  But given that the user may or
	may not want an decoded URI, I’d rather introduce a customizable
	variable for that, yes.

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A





^ 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).