Rev 7946 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\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 arehuman-readable and those that have special charactersescaped. 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 orunescaped.}\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. Thenames are the characters we encode, the values are what we encode themas.}\item{post.amp}{a logical value controlling whether the resultingstring is further processed to escape the percent (\%) prefixes withthe 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 elementsto the input with the characters escaped or not.}\references{Curl homepage \url{https://curl.se/}Percent encoding explained in \url{https://en.wikipedia.org/wiki/Percent-encoding}}\author{Duncan Temple Lang}\examples{curlEscape("http://www.abc.com?x=a is a sentence&a b=and another")# Reverse it should get back originalcurlUnescape(curlEscape("http://www.abc.com?x=a is a sentence&a b=and another"))}\keyword{IO}