Unicode and Punycode Domain Name Processing
Overview
High-performance Unicode and Punycode processing for internationalized domain names. The 'puny_encode()' / 'puny_decode()' helpers are a low-level, RFC 3492 compliant Punycode codec for domain labels (the 'xn--' ASCII-Compatible Encoding of RFC 5890/5891); they perform the raw transform plus letter-digit-hyphen checks and do not apply Unicode IDNA normalization. 'host_normalize()' is the Unicode Technical Standard #46 host-normalization entry point, mapping a host name to a canonical lowercase ASCII comparison form (non-transitional profile, pinned default Unicode version, selectable per call from the set the build ships). Aimed at host normalization and data analysis workflows. Used as the Punycode and IDNA engine by the 'pslr' and 'rurl' packages.
Breaking changes
- **The pinned Unicode version moved from 16.0.0 to 17.0.0, and the profile token is now
uts46-nontransitional-std3-v2.** A call that names nounicode_versionnow normalizes against Unicode 17.0.0 data. The change is accept-only in practice: across both vendored IdnaTestV2 corpora and all 8 flag combinations, the new default matches an explicit"17.0.0"in all 102,448 comparisons and differs from"16.0.0"on 3 rows (16.0.0 corpus) and 5 rows (17.0.0 corpus) --- every one of themNAbecoming a value, with zero changed values. Nothing that normalized before stops normalizing. The-v1→-v2bump is deliberate and is the part to act on. The bare token means "whatever the pin is", so without the bump one string would have denoted 16.0.0 before this release and 17.0.0 after. Anything using the token as a cache or reproducibility key must re-key: a stale key now misses loudly instead of colliding silently. Callers who want the old data can passunicode_version = "16.0.0", which is still shipped and returns identical results to 1.2.1 --- their token becomesuts46-nontransitional-std3-v2+unicode-16.0.0.pslrdetects the move on its own (it compares bothnormalization_profileandunicode_version, and rebuilds its index on either mismatch), so the effect there is a one-time rebuild on load until it reships, not a stale answer. This release also fixes the shipped-versions policy: punycoder ships the **current and the previous** Unicode version, and a version is deprecated for one release cycle --- announced here, still shipped and selectable --- before it is dropped (ADR-017).
Show all changes in 1.3.0Hide the rest of the changes in 1.3.0
- The deprecated URL surface ---
url_encode(),url_decode(), andparse_url()--- has been **removed**, one release after the.Deprecated()warning cycle introduced in 1.2.0. These were always best-effort host extraction/rewriting, never an RFC 3986 / WHATWG URL parser or canonicalizer. Use therurlpackage for URL parsing and canonicalization, or pass the host alone tohost_normalize()/puny_encode()/puny_decode()for host-only needs.puny_encode()/puny_decode()continue to reject URL-shaped input with an actionable error pointing atrurl::get_host(). The internal URL parser (punycoder_url.cpp) and thepunycoder_parsed_urlprint method are gone with the surface. is_punycode()andis_idn()now agree on input that is not well-formed UTF-8, and both reportFALSEfor it. Previouslyis_punycode()reportedTRUE**silently** for such input --- steering callers intopuny_decode()for a string every other function in the package refuses to process --- whileis_idn()warned and reportedFALSE. The split was not deliberate:is_punycode()matches with R's default TRE engine, which matches bytewise, andis_idn()usedperl = TRUE, where PCRE validates UTF-8 first. Both now share one gate, so the spuriousis_idn()warning is gone too. The predicates remain total and strictly logical --- neverNA, never an error --- soif (is_punycode(x))is always safe; callvalidUTF8(x)to distinguish "not punycode" from "not well-formed text". Answers for well-formed input, including strings markedlatin1, are unchanged.
New features
- The Unicode table set is now selectable per call.
host_normalize(x, unicode_version = )andnormalization_profile_info(unicode_version = )accept any version this build ships, and a newunicode_versions()reports what that is (currently"16.0.0"and"17.0.0").NULL, the default, means the pinned version --- which this release moves to 17.0.0, see Breaking changes above;NULLnever means "newest", so a later release compiling in another table set will not change results underneath a caller. Selecting another version appends+unicode-<version>to that token, on the same rule as a relaxed flag, so two normalizations that genuinely differ can never mintidentical()tokens. Naming a version the build does not ship is an error listing what is available, never a silent fall back to the pin --- a fallback would let a caller record a profile identity describing a normalization that never ran. There is deliberately **no** global option for this: unlikepunycoder.strict, which is an error-policy preference, the Unicode version is part of profile identity, and making identity ambient would let the same code mint different reproducibility keys in different sessions (ADR-016). validate_domain()results are now readable at scale.print()opens with a count header (12 domains: 5 valid, 7 invalid (strict = TRUE)), stops after 10 per-domain blocks with a... and N morefooter instead of dumping one block per element, and shows each error's machine-readable code alongside its message. A newsummary()method condenses the whole vector into a data frame oferror_code/nsorted by count descending, carryingn,n_valid,n_invalid, andstrictas attributes, so failures across a large batch can be tallied programmatically.host_normalise()andnormalisation_profile_info()are now exported as British-spelling aliases ofhost_normalize()andnormalization_profile_info(). Each alias is the same function as its US-spelled primary and is documented on the primary's help page; the US spellings stay the canonical names (SEOR-qwomlgjd).
Bug fixes
- The tracker links a reader clicks --- in
codemeta.json,SECURITY.md,.bestpractices.jsonand the intro vignette --- now point at the GitLab tracker'swork_itemspath. The path they used before returns 404 across gitlab.com since GitLab moved issues platform-wide, so the address shipped in those files no longer resolved for an anonymous reader.DESCRIPTION'sBugReports:is deliberately **not** repointed and keeps naminghttps://gitlab.com/bart-turczynski/punycoder/-/issues(see the next entry): CRAN's incoming check accepts a gitlab.comBugReports:only when the path ends in/-/issues, and the NOTE it emits otherwise archived a sibling package at the pretest. That check readsDESCRIPTIONalone, so the two audiences are served independently; the URL check's 404 on the/-/issuesaddress is expected and is explained incran-comments.md(PUNY-uixamcbp, PUNY-fxwavtvu). BugReports:points at the GitLab tracker's/-/issuespath, the form CRAN's incoming check requires (a browser is redirected to/-/work_items) (PUNY-yomemdzz).puny_decode()now rejects malformed A-label input consistently across backends. The in-tree fallback decoder previously accepted non letter-digit-hyphen (LDH) characters in a label's literal section (e.g.xn--(o)-...) and echoed an empty Bootstring payload (xn---) back unchanged, where libidn2 rejected both. It now applies the documented LDH check to decode input and reports these as an error understrict = TRUE/NAunderstrict = FALSE, so the two backends agree on every input.puny_encode(),puny_decode(), andvalidate_domain()now transcode character input to UTF-8 before dispatching to native code, and Unicode output is explicitly marked as UTF-8. Previously onlyhost_normalize()transcoded, so a Latin-1-marked (or non-UTF-8 native) host reached the UTF-8 decoder as ill-formed bytes and the same string produced different answers depending on how R happened to mark it (#67).
Performance
host_normalize()no longer normalizes input that is already normalized --- **1.22x** on all-ASCII hosts, 1.21x at 20% non-ASCII, 1.22x at 50%, and 1.19x when every host is non-ASCII. Unicode NFC ran unconditionally, so a host that was already in NFC --- which nearly all real host text is --- paid for a full decompose, canonical-reorder and recompose pass to produce a byte-identical copy of itself. An all-ASCII host was making 295,792 pointless composition attempts per 20,000 hosts.nfc()now applies the UAX #15 quick check (NFC_Quick_Checkplus a combining-class ordering test) and returns its input untouched when it passes; below U+0300 that costs one comparison per character and no table read at all. This is the largest single normalizer win in this release, and unlike the table work below it helps ASCII input most, because that input was paying the most for nothing. Input that genuinely needs normalizing does not regress: on a corpus transformed to NFD, so the check always fails, throughput is still 1.13x/1.07x/1.01x, because the check abandons at the first character that fails rather than scanning to the end.NFC_Quick_Check=Maybeis treated as a real third value and falls through to the full pipeline. Output is unchanged on every input in the UTS #46 conformance corpus under all supported flag combinations, andnfc()was verified against the pipeline it skips over all 19,965 rows of the official UAX #15 normalization corpus, every single code point, and 280 million code-point pairs.host_normalize()is faster again on non-ASCII hosts --- **1.05x** when every host is non-ASCII, 1.04x at 50%, 1.03x at 20%, unchanged on all-ASCII input --- with the last Unicode table still on a binary search converted. Canonical composition is keyed on a *pair* of code points, so it could not become a trie the way the four accessors below did; it is now a trie on the **first** element with a short scan over that starter's partners behind it. Keying on the first element is measured rather than assumed: the 961 pairs hold 391 distinct first elements but only 72 distinct second ones, so the runs to scan are a median of 1 long instead of 3, and it is the first element that answers the common *reject* --- a starter that never composes, such as any CJK ideograph, used to walk the whole 961-pair search only to conclude 0. The accessor is 6.1x faster on that reject path and 2.5x on a successful composition, and its share of self time falls from 5.3% to 1.9%. The end-to-end figure is smaller than either of those because most attempted compositions never reach the table at all: 87% of them are answered by the bound on the second element, since that element is just the next character after a starter and ordinary text is not combining marks. That bound is now exposedinlinefrom the generated header and applied *before* the call rather than inside it, which is what makes the ASCII-heavy end of the range faster rather than merely unchanged. Output is unchanged on every input in the UTS #46 conformance corpus under all supported flag combinations.host_normalize()is faster on non-ASCII hosts --- **1.25x** when every host is non-ASCII, 1.16x at 50%, 1.08x at 20%, and unchanged on all-ASCII input --- and the installed shared object is **64 KB smaller**. The four Unicode accessors that profiled hot (combining class, UTS #46 mapping, canonical decomposition,Bidi_Class) no longer binary-search: each is a two-stage trie, two loads and no branches, O(1) for every code point rather than only for ASCII. The previous release made ASCII free but left every non-ASCII code point paying 11-14 branch-mispredicting probes --- and the worst case was not an exotic character but a common one the table does not list, since every CJK ideograph walked the whole combining-class table only to conclude 0. Table lookups fell from 33% of self time to 17% on an all-non-ASCII corpus. Storing identical blocks once, and keying the UTS #46 trie on distinct (status, mapping) values rather than on ranges, is what makes the structure smaller than the range tables it replaced. Every array, element type and block size is derived indata-raw/generate_unicode_tables.R, which now also verifies each trie against its source ranges for all 1,114,112 code points before emitting it. Output is unchanged on every input in the UTS #46 conformance corpus under all supported flag combinations.host_normalize()is substantially faster again --- **1.75x** on all-ASCII hosts, 1.36x on a mixed corpus at 20% non-ASCII, and 1.12x even when every host is non-ASCII. Lookups into the vendored Unicode tables were 56% of process time: seven near-identical binary searches, ~14 branch-mispredicting probes per code point for the 9,185-range UTS #46 table alone. They now share one search, and each answers ASCII --- the dominant input --- without searching at all, via a 128-entry direct index for the two tables that cover ASCII and a bounds test for the rest. Every boundary is derived indata-raw/generate_unicode_tables.Rfrom the UCD data itself, so it cannot drift from the table it guards and a Unicode version bump moves it automatically. Output is unchanged on every input in the UTS #46 conformance corpus under all supported flag combinations.host_normalize()is roughly 25-30% faster. Label validation no longer re-runs Unicode NFC on labels taken straight from the label split: NFC is applied to the whole host before splitting, and U+002E is a safe break point (it appears in no canonical decomposition and no composition pair), so those labels are already in NFC by construction. Punycode-decoded A-label payloads, which never go through that pass, are still checked. Output is unchanged on every input in the UTS #46 conformance corpus, under all supported flag combinations.
Internal
- The documentation site is published at <https://bart-turczynski.gitlab.io/punycoder/>, the GitLab Pages namespace path every package in the family uses.
DESCRIPTION'sURL:,_pkgdown.ymland.bestpractices.jsonname it; the project's unique-domain Pages address no longer resolves (PUNY-rsxtbbln, SEOR-hcmtspmv). - The agent instructions no longer import fp's generated
FP_CLAUDE.md, and point at the houseagent-workflowandfpskills for the git workflow. The tracker snapshot is refreshed before a copy leaves the machine, not on every issue closure (SEOR-ipwcbcov, PUNY-lezxwoov). - **CI folds the formerly-separate
lint,readme, andnews-versionjobs into onegatesjob.** Each was cheap on its own -- well under a minute of real checking combined -- but every GitLab job pays a roughly constant ~2 minute tax for runner pickup and setup regardless of how little script it runs.scripts/gates.Rruns all three checks unconditionally, accumulates a PASS/FAIL for each, and prints one summary before exiting nonzero if any failed, so folding them costs no diagnostic signal.citation-versionwas a candidate but stayed its own job: it needspython3, which thelint/readme/news-versionjobs' sharedrocker/r-verimage does not have (SEOR-pgammbgo). - **
full-checkandsanitizerscan now run on a weekly schedule instead of only on a release tag or by hand.**osv-auditandsecurity-audit, which already ran on any pipeline schedule, now additionally require aSCHEDULE_KINDselector so a second schedule (for the release-shaped checks) cannot silently also fire the dependency audits. Adding the actual pipeline schedules is a separate, manual step (SEOR-ihmntqzm). - The
readmecheck, now inside thegatesjob, ignores blank-line-only differences inREADME.md. pandoc versions disagree about the blank line after the badges marker, so a README rendered with a newer local pandoc passed the pre-push gate and then failed CI, as it did in seor (SEOR-kaqtnovh). - The pkgdown site no longer publishes the repository's agent instruction files. pkgdown renders every top-level
.md, soAGENTS.htmlandCLAUDE.htmlwere being served next to the function reference; thepagesjob now strips them with a glob beforebuild_site(SEOR-pibdjanz). - **CI now creates exactly one pipeline per merge, on
main, instead of three.** Theworkflow:block used to allow both merge-request and branch pipelines (suppressing the branch one only when an MR was already open). CI runs on a self-hosted Docker runner on one Mac, not on GitLab.com's shared runners, and its few job slots are shared by six of the fleet's repositories. The branch and MR pipelines test the same tree as the eventualmainpipeline an
The NEWS section is longer than shown here.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK7 OK2026-06-12
Documentation
- Help pages
- 12 (1 internal)includes a package overview page
- Examples that run
- 100%12 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 75%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- GitHub only
- Median days to close, 50 most recently updated closed PRs
- GitHub only
- github.com/bart-turczynski/punycoder · last recorded on 2026-09-30
18 development-tooling and community-health practices detected across 9 families in the upstream repository
Checks run against gitlab.com/bart-turczynski/punycoder on 2026-10-21.
GitHub Pages site
Show all practicesHide 5 practices
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-03-13Seen in the repository: CLAUDE.mdNamed in .Rbuildignore: CLAUDE.mdNamed in .gitignore: .claudeCommits: at least 247 crediting it in the message
- Claude Opus 5.597 commits · Sep to Oct 2026
- Claude Opus 4.864 commits · Jun to Jul 2026
- Claude Opus 561 commits · Jul to Sep 2026
- Claude Opus 4.713 commits · May 2026
- Claude Sonnet 4.67 commits · Jun 2026
2 more models not listed.
Dependencies
Installing punycoder adds 1 package (1 with compiled code, 1.8 MB of source tarballs). Heaviest: Rcpp 1.8 MB.
Code & Tests
People & History
Package metadata
- First published
- 2026-06-11
- Total releases
- 4 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 3.5.0
- Download size
- 517 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("punycoder")The package provides a citation file that builds its entry when R runs it. Run citation() to see it.
The repository also keeps a CITATION.cff.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-23, which the citation names so these numbers can be found later. More on citing and the projects behind them.