urlescapinguripercent-encodingrfc3986

Why isn't % (percent) considered a reserved character in RFC 3986 (URI Syntax)?


Clearly % needs to be encoded. The wikipedia article on the standard says:

Because the percent ("%") character serves as the indicator for percent-encoded octets, it must be percent-encoded as "%25" for that octet to be used as data within a URI.

Why isn't it also listed as a reserved character? Clearly it is reserved to signify something special in the context of a URI...


Solution

  • The "reserved" characters are intended to be available as delimiters between different parts of a URI. The percent-sign isn't used for that — can't be used for that — because of its use in percent encoding.

    It may help clarify matters to point out that there's a separate list of "unreserved" characters, and the percent-sign is not one of those, either:

          unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"
    

    (from http://www.ietf.org/rfc/rfc3986.txt, bottom of page 12). In other words, in the context of URIs, "reserved" has a more specific meaning than one might expect. :-)