encoder: Encode or decode a URI

Description Usage Arguments Details Value See Also Examples

Description

encodes or decodes a URI/URL

Usage

1
2
3
url_decode(urls)

url_encode(urls)

Arguments

urls

a vector of URLs to decode or encode.

Details

URL encoding and decoding is an essential prerequisite to proper web interaction and data analysis around things like server-side logs. The relevant IETF RfC mandates the percentage-encoding of non-Latin characters, including things like slashes, unless those are reserved.

Base R provides URLdecode and URLencode, which handle URL encoding - in theory. In practise, they have a set of substantial problems that the urltools implementation solves::

Value

a character vector containing the encoded (or decoded) versions of "urls".

See Also

puny_decode and puny_encode, for punycode decoding and encoding.

Examples

1
2
3
4
5
6
7
8
9
url_decode("https://en.wikipedia.org/wiki/File:Vice_City_Public_Radio_%28logo%29.jpg")
url_encode("https://en.wikipedia.org/wiki/File:Vice_City_Public_Radio_(logo).jpg")

## Not run: 
#A demonstrator of the contrasting behaviours around out-of-range characters
URLdecode("%gIL")
url_decode("%gIL")

## End(Not run)

urltools documentation built on May 1, 2019, 6:49 p.m.