URLencode

0th

Percentile

Encode or Decode a (partial) URL

Functions to encode or decode characters in URLs.

Keywords
utilities
Usage
URLencode(URL, reserved = FALSE) URLdecode(URL)
Arguments
URL
A character string.
reserved
should reserved characters be encoded? See ‘Details’.
Details

Characters in a URL other than the English alphanumeric characters and - _ . ~ should be encoded as % plus a two-digit hexadecimal representation, and any single-byte character can be so encoded. (Multi-byte characters are encoded as byte-by-byte.)

In addition, ! $ & ' ( ) * + , ; = : / ? @ # [ ] are reserved characters, and should be encoded unless used in their reserved sense, which is scheme specific. The default in URLencode is to leave them alone, which is appropriate for file:// URLs, but probably not for http:// ones.

Value

A character string.

References

RFC 3986 http://tools.ietf.org/html/rfc3986

Aliases
  • URLencode
  • URLdecode
Examples
library(utils) (y <- URLencode("a url with spaces and / and @")) URLdecode(y) (y <- URLencode("a url with spaces and / and @", reserved = TRUE)) URLdecode(y) URLdecode("ab%20cd")
Documentation reproduced from package utils, version 3.1.2, License: Part of R 3.1.2

Community examples

Looks like there are no examples yet.