finds.dev← search

// the find

mathiasbynens/punycode.js

★ 1,691 · JavaScript · MIT · updated Apr 2024

A robust Punycode converter that fully complies to RFC 3492 and RFC 5891.

A small, well-documented Punycode encoder/decoder for JavaScript, implementing RFC 3492/5891 conversion between Unicode domain labels and their ASCII Punycode form. It's aimed at anyone doing IDN (internationalized domain name) or email address normalization who needs a correct implementation rather than a reference one.

The code is the result of explicitly comparing multiple prior implementations (RFC appendix C, ICU, Node's old core module) rather than being a first attempt, which shows in the edge-case handling around surrogate pairs via the ucs2 encode/decode helpers. It's dependency-free, ships as a plain CommonJS/ES2015+ module, and was trusted enough to be bundled in Node core for years. The API surface is tiny and single-purpose (encode/decode/toASCII/toUnicode), so there's nothing to configure or get wrong.

Last push was April 2024 and the library is functionally frozen — that's fine for a spec-compliant algorithm, but it also means no active maintenance if an edge case surfaces. The README's Node.js warning about `require('punycode')` silently pulling the deprecated core module instead of the npm package is a real footgun that's easy to miss. There's a single flat tests.js with no visible coverage reporting, and no TypeScript types shipped in the package itself (you're relying on DefinitelyTyped or ambient shims). Also worth noting: the older v1.4.1 UMD build (for pre-ES2015 environments) is a separate tag, not the default install, so anyone needing legacy runtime support has to know to go find it.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →