File: curlEscape.Rd

package info (click to toggle)
r-cran-rcurl 1.95-4.8-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,140 kB
  • ctags: 515
  • sloc: ansic: 3,135; xml: 1,734; asm: 993; sh: 12; makefile: 2
file content (57 lines) | stat: -rw-r--r-- 1,896 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
\name{curlEscape}
\alias{curlEscape}
\alias{curlUnescape}
\alias{curlPercentEncode}
\title{Handle characters in URL that need to be escaped}
\description{
  These functions convert between URLs that are
  human-readable and those that have special characters
  escaped.  For example, to send a URL with a space,
  we need to represent the space as \code{\%20}.

  \code{curlPercentEncode} uses a different format than the
  \code{curlEscape}
  function and this is needed for x-www-form-encoded POST submissions.
}
\usage{
curlEscape(urls)
curlUnescape(urls)
curlPercentEncode(x, amp = TRUE, codes = PercentCodes, post.amp = FALSE)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{urls}{ a character vector giving the strings to be escaped or
    unescaped.}
  \item{x}{the strings to be encoded via the percent-encoding method}
  \item{amp}{a  logical value indicating whether to encode \&
    characters.}
  \item{codes}{the named character vector giving the encoding map. The
    names are the characters we encode, the values are what we encode them
    as.}
  \item{post.amp}{a logical value controlling whether the resulting
  string is further processed to escape the percent (\%) prefixes with
  the code for percent, i.e. \%25.}
}
\details{
  This calls \code{curl_escape} or \code{curl_unescape} in the libcurl library.
}
\value{
  A character vector that has corresponding elements
  to the input with the characters escaped or not.
}
\references{
  Curl homepage \url{http://curl.haxx.se}
  
  Percent encoding explained in \url{http://en.wikipedia.org/wiki/Percent-encoding}
}
\author{Duncan Temple Lang <duncan@wald.ucdavis.edu>}

\examples{
  curlEscape("http://www.abc.com?x=a is a sentence&a b=and another")

  # Reverse it should get back original
  curlUnescape(curlEscape("http://www.abc.com?x=a is a sentence&a b=and another"))
}
\keyword{IO}