url_decode: Decode URLs with ASCII punycode domains to Unicode

View source: R/url-utils.R

url_decodeR Documentation

Decode URLs with ASCII punycode domains to Unicode

Description

Converts URLs containing ASCII punycode domain names back to their Unicode representation for display purposes. This function makes internationalized URLs human-readable.

Usage

url_decode(url, strict = getOption("punycoder.strict", TRUE))

Arguments

url

Character vector of URLs with ASCII punycode domains

strict

Logical; whether to apply strict validation. Defaults to 'getOption("punycoder.strict", TRUE)'.

Value

A character vector the same length as url, with each element containing the URL with its host portion decoded to Unicode. Only the domain component is transformed; scheme, path, query, and fragment are preserved. Elements corresponding to NA inputs are NA_character_.

See Also

url_encode for the reverse operation, puny_decode for domain-only decoding, parse_url for URL component extraction.

Examples


# Basic URL decoding
url_decode("https://xn--caf-dma.example.com/path")
url_decode("https://xn--80adxhks.xn--p1ai/page")

# Vectorized URL decoding
ascii_urls <- c(
  "https://xn--caf-dma.com/menu",
  "https://xn--1qqw23a.xn--55qx5d/info"
)
url_decode(ascii_urls)


punycoder documentation built on June 16, 2026, 9:07 a.m.