URLencode
Encode or Decode a (partial) URL

Description

Encodes or decodes a URL character.

Usage

URLencode(URL, reserved = FALSE, repeated = FALSE)
URLdecode(URL)

Arguments

URL a vector of character strings containing the URL to encode or decode.
reserved a logical value. If TRUE, reserved characters in URL are converted to percent-escaped hexadecmial digits. The default is FALSE.
repeated a logical value. If FALSE, will not change the string if it appears to already be encoded (i.e. it already contains "%" followed by two hex digits). The default is FALSE.

Details

For URLencode, characters of URL that are not alphabetic, digits, "-", ".", "_", or "~" are coverted to hexadecimal digits prefixed by "%". If reserved is FALSE (the default), the following URL reserved characters are also converted to hexadecimal characters prefixed by "%".
":" "/" "?"
"#" "[" "]"
"@" "!" "$"
"&" "'" "("
")" "*" "+"
"," ";" "="

For URLdecode, if URL has any character sequences %xx (where x is a hexadecimal digit (that is, 0-9, A-F, or a-f)), they are converted back into character strings. See References for a link to more details about the URL encoding process.
Value
URLencodereturns a character string containing the encoded URL.
URLdecodereturns a character string containing the decoded URL.
References
Berners-Lee, T., Fielding, R., and Masinter, L. 2005. Uniform Resource Identifier (URI): Generic Syntax. http://www.rfc-editor.org/rfc/rfc3986.txt. Network Working Group.
Examples
url <- URLencode("http://www.tibco.com")
urlres <- URLencode("http://www.tibco.com", reserved = TRUE)
URLdecode(url)
URLdecode(urlres)

URLencode("a b URLencode("a b

Package utils version 6.1.1-7
Package Index