Learn R Programming

urlparse (version 0.2.1)

encoding: Escape characters for use in URLs.

Description

This function encodes a character vector for use in URLs, escaping all special characters except for those specified in the safe parameter.

Usage

url_encoder(urls, safe = "")

url_decoder(urls)

Value

A character vector with the encoded URLs.

Arguments

urls

A character vector to be encoded/decoded.

safe

A character vector of extra characters that should not be encoded.

Examples

Run this code
library(urlparse)

# Example 1:
url_encoder("foo = bar + 5")

# Example 2:
# prevent special characters being encoded:
url <- "https://example.com/path?query= 1+2"
url_encoder(url, ":/?=")

# Example 3:
url_decoder(url_encoder("foo = bar + 5"))

Run the code above in your browser using DataLab