idna
IDNA (Internationalizing Domain Names in Applications) and Punycode.
This package has a good security score with no known vulnerabilities.
Community Reviews
Solid, zero-allocation IDNA implementation with minimal ceremony
Error handling is well-typed through the `Errors` enum, though you'll need to map these to your own domain errors in most HTTP/network stacks. The crate has no configuration knobs because there aren't really any needed - it just implements the IDNA spec. One gotcha: the validation is strict per spec, so strings that browsers might accept can fail here. There's no logging or observability hooks, but for a pure function library that's appropriate.
The 1.0 release cleaned up the API significantly from 0.x versions. If you're upgrading, expect some minor breaking changes in error types. Day-to-day usage is uneventful in the best way - it works, it's fast, and you don't think about it.
Best for: Applications needing spec-compliant IDNA conversion for domain names in HTTP clients, DNS libraries, or URL parsers.
Avoid if: You need lenient parsing that matches browser behavior exactly or require extensive configuration options.
Reliable IDNA implementation with simple API, but sparse documentation
The main issue is documentation sparseness. While the API surface is small and intuitive enough to figure out through the function signatures, there's minimal guidance on error cases or edge cases. Error types exist but aren't well-documented, so you'll spend time looking at the source to understand what failures mean. The crate handles validation internally, which is good for correctness but can be opaque when debugging why a particular domain fails.
Type safety is solid as you'd expect from Rust, and IDE autocompletion works fine given the simple API. For production use converting user-inputted domain names, this is the de facto choice in the Rust ecosystem and has proven reliable across multiple projects.
Best for: Production applications needing standard-compliant internationalized domain name handling with minimal complexity.
Avoid if: You need extensive documentation and examples, or require fine-grained control over IDNA processing steps.
Solid IDNA implementation with straightforward API, minimal friction
Error handling is reasonable with the `Errors` enum covering the typical validation failures, though error messages could be more descriptive about *why* a domain fails validation. The crate handles edge cases well - I've thrown malformed input at it and gotten sensible results. Documentation is concise but adequate, with enough examples to get started.
One minor annoyance: no builder pattern for configuration options. You're stuck with the default UTS46 processing rules unless you use the lower-level APIs. For 95% of use cases this is fine, but if you need custom validation behavior, you'll need to dig deeper into the implementation. Type signatures are clean and play well with Rust's type system - no surprises with lifetimes or complex generics.
Best for: Standard IDNA encoding/decoding in web applications, URL parsers, and network tools where you need RFC-compliant domain name handling.
Avoid if: You need fine-grained control over IDNA validation rules or extensive customization of the Unicode normalization process.
Sign in to write a review
Sign In