\HeaderA{URLencode}{Encode or Decode a (partial) URL}{URLencode}
\aliasA{URLdecode}{URLencode}{URLdecode}
\keyword{utilities}{URLencode}
\begin{Description}\relax
Functions to encode or decode characters in URLs.
\end{Description}
\begin{Usage}
\begin{verbatim}
URLencode(URL, reserved = FALSE)
URLdecode(URL)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{URL}] A character string.
\item[\code{reserved}] should reserved characters be encoded? See Details.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Characters in a URL other than the English alphanumeric characters and
\code{\$ - \_ . + ! * ' ( ) ,} should be encoded as \code{\%}
plus a two-digit hexadecimal representation, and any single-byte
character can be so encoded. (Multi-byte characters are encoded as
byte-by-byte.)

In addition, \code{; / ? : @ = \&} are reserved characters, and should
be encoded unless used in their reserved sense, which is scheme
specific.  The default in \code{URLencode} is to leave them alone, which
is appropriate for \code{file://} URLs, but probably not for
\code{http://} ones.
\end{Details}
\begin{Value}
A character string.
\end{Value}
\begin{References}\relax
RFC1738, \url{http://www.rfc-editor.org/rfc/rfc1738.txt}
\end{References}
\begin{Examples}
\begin{ExampleCode}
(y <- URLencode("a url with spaces and / and @"))
URLdecode(y)
(y <- URLencode("a url with spaces and / and @", reserved=TRUE))
URLdecode(y)
URLdecode("ab%20cd")
\end{ExampleCode}
\end{Examples}

