Provides high-performance functions for processing internationalized domain names, split across two tiers.
Details
The package exposes two distinct surfaces, deliberately kept separate:
A low-level Punycode codec (
puny_encode()/puny_decode()): the raw RFC 3492 transform withxn--A-label framing (RFC 5890/5891) and letter-digit-hyphen checks. It performs no Unicode normalization.An IDNA/UTS-46 host-normalization surface (
host_normalize()): Unicode NFC, UTS #46 mapping and validation, and conversion to a canonical lowercase ASCII comparison form under a pinned profile.
Use the codec when you need the literal ASCII-Compatible Encoding of a
label; use host_normalize() when you need a standards-profiled
comparison form for a host name.
Author
Maintainer: Bart Turczynski bartek@turczynski.pl (ORCID)
Authors:
Bart Turczynski bartek@turczynski.pl (ORCID)
Examples
# Tier 1 - low-level codec: the raw RFC 3492 transform.
puny_encode("caf\u00E9.com")
#> [1] "xn--caf-dma.com"
puny_decode("xn--caf-dma.com")
#> [1] "café.com"
# Tier 2 - UTS #46: canonical lowercase ASCII comparison form.
host_normalize(c("Example.COM", "M\u00DCNCHEN.de"))
#> [1] "example.com" "xn--mnchen-3ya.de"