The R Project SVN R

Rev

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

Rev 69207 Rev 78989
Line 4... Line 4...
4
% Distributed under GPL 2 or later
4
% Distributed under GPL 2 or later
5
 
5
 
6
\name{URLencode}
6
\name{URLencode}
7
\alias{URLencode}
7
\alias{URLencode}
8
\alias{URLdecode}
8
\alias{URLdecode}
9
\title{Encode or Decode a (partial) URL}
9
\title{Encode or Decode (partial) URLs}
10
\description{
10
\description{
11
  Functions to percent-encode or decode characters in URLs.
11
  Functions to percent-encode or decode characters in URLs.
12
}
12
}
13
\usage{
13
\usage{
14
URLencode(URL, reserved = FALSE, repeated = FALSE)
14
URLencode(URL, reserved = FALSE, repeated = FALSE)
15
URLdecode(URL)
15
URLdecode(URL)
16
}
16
}
17
\arguments{
17
\arguments{
18
  \item{URL}{a character string.}
18
  \item{URL}{a character vector.}
19
  \item{reserved}{logical: should \sQuote{reserved} characters be
19
  \item{reserved}{logical: should \sQuote{reserved} characters be
20
    encoded? See \sQuote{Details}.}
20
    encoded? See \sQuote{Details}.}
21
  \item{repeated}{logical: should apparently already-encoded URLs be
21
  \item{repeated}{logical: should apparently already-encoded URLs be
22
    encoded again?}
22
    encoded again?}
23
}
23
}
Line 36... Line 36...
36
 
36
 
37
  An \sQuote{apparently already-encoded URL} is one containing
37
  An \sQuote{apparently already-encoded URL} is one containing
38
  \code{\%xx} for two hexadecimal digits.
38
  \code{\%xx} for two hexadecimal digits.
39
}
39
}
40
\value{
40
\value{
41
  A character string.
41
  A character vector.
42
}
42
}
43
\references{
43
\references{
44
  Internet STD 66 (formerly RFC 3986),
44
  Internet STD 66 (formerly RFC 3986),
45
  \url{https://tools.ietf.org/html/std66}
45
  \url{https://tools.ietf.org/html/std66}
46
}
46
}
Line 50... Line 50...
50
(y <- URLencode("a url with spaces and / and @", reserved = TRUE))
50
(y <- URLencode("a url with spaces and / and @", reserved = TRUE))
51
URLdecode(y)
51
URLdecode(y)
52
 
52
 
53
URLdecode(z <- "ab\%20cd")
53
URLdecode(z <- "ab\%20cd")
54
c(URLencode(z), URLencode(z, repeated = TRUE)) # first is usually wanted
54
c(URLencode(z), URLencode(z, repeated = TRUE)) # first is usually wanted
-
 
55
 
-
 
56
## both functions support character vectors of length > 1
-
 
57
y <- URLdecode(URLencode(c("url with space", "another one")))
55
}
58
}
56
\keyword{utilities}
59
\keyword{utilities}