The R Project SVN R

Rev

Rev 34324 | Rev 34354 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34324 Rev 34340
Line 4... Line 4...
4
\title{Encode or Decode a (partial) URL}
4
\title{Encode or Decode a (partial) URL}
5
\description{
5
\description{
6
  Functions to encode or decode characters in URLs.
6
  Functions to encode or decode characters in URLs.
7
}
7
}
8
\usage{
8
\usage{
9
URLencode(UR, reserved = TRUE)
9
URLencode(UR, reserved = FALSE)
10
URLdecode(URL)
10
URLdecode(URL)
11
}
11
}
12
\arguments{
12
\arguments{
13
  \item{URL}{A character string.}
13
  \item{URL}{A character string.}
14
  \item{reserved}{should reserved characters be encoded? See Details.}
14
  \item{reserved}{should reserved characters be encoded? See Details.}
15
}
15
}
16
\details{
16
\details{
17
  Characters in a URL other than the English alphanumeric characters and
17
  Characters in a URL other than the English alphanumeric characters and
18
  \code{$ - _ . + ! * ' ( ) ,} should be encoded as \code{\%}
18
  \code{$ - _ . + ! * ' ( ) ,} should be encoded as \code{\%}
19
  plus a two-digit hexadecimal representation, and any single-byte
19
  plus a two-digit hexadecimal representation, and any single-byte
20
  character can be so encoded.  (Multi-byte characters are encoded as bytes.) 
20
  character can be so encoded. (Multi-byte characters are encoded as
-
 
21
  byte-by-byte.)
21
  
22
  
22
  In addition, \code{; / ? : @ = &} are reserved characters, and should
23
  In addition, \code{; / ? : @ = &} are reserved characters, and should
23
  be encoded unless used in their reserved sense, which is scheme
24
  be encoded unless used in their reserved sense, which is scheme
24
  specific.  Thie default in \code{URLencode} is to encode them, which
25
  specific.  The default in \code{URLencode} is to leave them alone, which
25
  is appropriate for \code{file://} URLs, but probably not for
26
  is appropriate for \code{file://} URLs, but probably not for
26
  \code{http://} ones.
27
  \code{http://} ones.
27
}
28
}
28
\value{
29
\value{
29
  A character string.
30
  A character string.
Line 32... Line 33...
32
  RFC1738, \url{http://www.rfc-editor.org/rfc/rfc1738.txt}
33
  RFC1738, \url{http://www.rfc-editor.org/rfc/rfc1738.txt}
33
}
34
}
34
\examples{
35
\examples{
35
(y <- URLencode("a url with spaces and / and @"))
36
(y <- URLencode("a url with spaces and / and @"))
36
URLdecode(y)
37
URLdecode(y)
37
(y <- URLencode("a url with spaces and / and @", FALSE))
38
(y <- URLencode("a url with spaces and / and @", reserved=TRUE))
38
URLdecode(y)
39
URLdecode(y)
39
URLdecode("ab\%20cd")
40
URLdecode("ab\%20cd")
40
}
41
}
41
\keyword{utilities}
42
\keyword{utilities}