From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Subject: Re: %-escapes in file URL
Date: Fri, 19 May 2006 08:09:39 +0000 (UTC) [thread overview]
Message-ID: <loom.20060519T100350-691@post.gmane.org> (raw)
In-Reply-To: E1FguLD-0001Qq-9W@fencepost.gnu.org
Richard Stallman <rms <at> gnu.org> writes:
>
> In dnd-handle-one-url, %-escapes in the given file URL is decoded
> immediately. But I think that should be done when extracting the file
> name from it (i.e., in dnd-get-local-file-name) in order to cope with
> applications outside Emacs via browse-url.
>
> Could you explain the connection, please?
>
(I'm resending this from Gmane, because my emails seem to be rejected by
mx10.gnu.org with "Unrouteable address" these days.)
Sure. RFC 2396 says:
2.4.2. When to Escape and Unescape
A URI is always in an "escaped" form, since escaping or unescaping a
completed URI might change its semantics. Normally, the only time
escape encodings can safely be made is when the URI is being created
from its component parts; each component may have its own set of
characters that are reserved, so only the mechanism responsible for
generating or interpreting that component can determine whether or
not escaping a character will change its semantics. Likewise, a URI
must be separated into its components before the escaped characters
within those components can be safely decoded.
So, URLs coming from other applications (e.g, via drag-and-drop)
should be assumed to be in escaped forms. Likewise, URLs going to
other applications (e.g., via browse-url) should be in escaped forms.
Some functions in browse-url such as `browse-url-netscape' does
%-escaping, but that is not re-escaping but just increasing the kind
of characters that should be escaped (notably `,' and `)').
A simple and natural policy is to always keep URLs in escaped forms,
whether or not they are used inside Emacs only. So, my proposal is as
follows:
* Always treat URLs as those in escaped form. Don't re-escape or
unescape them as long as they are URLs (i.e, have a prefix such as
"file://"). Increasing the kind of escaped characters is not
re-escaping.
* When creating a URL from a file name, encode the file name with
the file name coding system and then %-escape it.
* When creating a file name from a URL, %-unescape the URL and then
decode it with the file name coding system.
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
next prev parent reply other threads:[~2006-05-19 8:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-15 8:12 %-escapes in file URL YAMAMOTO Mitsuharu
2006-05-15 9:59 ` Jan Djärv
2006-05-15 12:55 ` YAMAMOTO Mitsuharu
2006-05-15 13:26 ` Jan Djärv
2006-05-19 2:03 ` Richard Stallman
2006-05-19 8:09 ` YAMAMOTO Mitsuharu [this message]
2006-05-19 9:33 ` Jan Djärv
2006-05-20 4:43 ` YAMAMOTO Mitsuharu
2006-05-20 5:04 ` Richard Stallman
2006-05-20 5:23 ` YAMAMOTO Mitsuharu
2006-05-20 17:05 ` If mail bounces Richard Stallman
2006-05-20 5:04 ` %-escapes in file URL Richard Stallman
2006-05-20 5:33 ` YAMAMOTO Mitsuharu
2006-05-20 17:05 ` Richard Stallman
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=loom.20060519T100350-691@post.gmane.org \
--to=mituharu@math.s.chiba-u.ac.jp \
/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 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).