Read-only mirror of gitlab.com/bart-turczynski/punycoder
翻譯準備中
正在載入完整 README。
檢視完整 README ↗High-performance Unicode and Punycode encoding/decoding for internationalized domain names (IDNs) in R.
The punycoder package provides fast, standards-based conversion between Unicode and ASCII representations of domain names, across two distinct surfaces:
puny_encode() / puny_decode() — the raw RFC 3492 transform with xn-- A-label framing (RFC 5890/5891) and letter-digit-hyphen checks, not an IDNA normalization API (no Unicode NFC, UTS #46 mapping, or case folding);host_normalize() — mapping a host name to its canonical lowercase ASCII comparison form under a pinned UTS #46 non-transitional profile.host_normalize() is a UTS #46 profile, not IDNA2008 conformance — UTS #46 is compatibility processing and deliberately accepts labels IDNA2008 would reject (e.g. ☕.example → xn--53h.example). See ?host_normalize and normalization_profile_info() for the normative profile and full standards references (RFC 3492/5890/5891/5892/5893, UTS #46, UAX #15/#44, STD 3, RFC 8753).
Normalization runs against vendored Unicode data, and a build ships a set of Unicode versions with one pinned as the default (currently 17.0.0, with 16.0.0 also shipped). unicode_versions() reports what the installed build carries, and host_normalize(x, unicode_version = "16.0.0") selects another one for a single call — which normalization_profile_info() reflects by appending +unicode-<version> to the reported profile token.
Install the released version of punycoder from CRAN with:
install.packages("punycoder")
Or install the development version from r-universe with:
install.packages(
"punycoder",
repos = c("https://bart-turczynski.r-universe.dev", "https://cloud.r-project.org")
)
To build it from source on GitLab instead:
# install.packages("remotes")
remotes::install_gitlab("bart-turczynski/punycoder")
punycoder needs R 4.1.0 or later and Rcpp, which install.packages() pulls
in. A binary install needs nothing else. A source install needs a C++ compiler,
which the standard R build tools for each platform provide. libidn2 2.3.5 or
later and pkg-config are optional: configure uses them for a native backend
when it finds both.
libidn2)punycoder works without extra system libraries. If libidn2 is available at
build time, the package enables a native backend automatically; otherwise it
uses the built-in C++ fallback backend.
To install the recommended optional dependency:
brew install libidn2 pkg-configsudo apt-get install libidn2-0-dev pkg-configsudo dnf install libidn2-devel pkgconf-pkg-configsudo pacman -S libidn2 pkgconfVerify the library is visible before installing punycoder from source:
system("pkg-config --modversion libidn2")
Then install/reinstall punycoder:
remotes::install_gitlab("bart-turczynski/punycoder")
以上為 README 的開頭部分。其餘內容請閱讀原文。 檢視完整 README ↗