[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[emms-help] Re: [Emms-patches] darcs patch: emms-url: Improve emms-url-q
[emms-help] Re: [Emms-patches] darcs patch: emms-url: Improve emms-url-quote.
Fri, 15 Feb 2008 16:11:11 +0900
Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (darwin)
Michael Olson <address@hidden> writes:
> The emms-player-mpd file, which I maintain, must be able to pass the
> entire URL. Otherwise I'd have to do some extra work that really ought
> to be handled by this function. It does not make sense to call
> something `emms-url-quote' and not have it handle real URLs.
Take an example from emms-lastfm.el:
(concat "&s=" emms-lastfm-session-id
"&a=" (emms-url-quote artist)
"&t=" (emms-url-quote title)
"&b=" (emms-url-quote album)
It's very common to have special characters like `&', `=' in a uri. If
one tries to call emms-url-quote on the full uri, it would be a pain to
have to list those special characters in `safe'.
Also, when I wrote that, I had referenced python's implementation, they
also: "By default, the quote function is intended for quoting the path
section of a URL."
quote('abc def') -> 'abc%20def'
Each part of a URL, e.g. the path info, the query, etc., has a
different set of reserved characters that must be quoted.
RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists
the following reserved characters.
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
"$" | ","
Each of these characters is reserved in some component of a URL,
but not necessarily in all of them.
By default, the quote function is intended for quoting the path
section of a URL. Thus, it will not encode '/'. This character
is reserved, but in typical usage the quote function is being
called on a path where the existing slash characters are used as