|
|
10 månader sedan | |
|---|---|---|
| .. | ||
| benches | 1 år sedan | |
| src | 1 år sedan | |
| tests | 10 månader sedan | |
| Cargo.toml | 1 år sedan | |
| LICENSE-APACHE | 9 år sedan | |
| LICENSE-MIT | 9 år sedan | |
| README.md | 1 år sedan | |
idnaIDNA library for Rust implementing UTS 46: Unicode IDNA Compatibility Processing as parametrized by the WHATWG URL Standard.
Apps that need to prepare a hostname for usage in protocols are likely to only need the top-level function domain_to_ascii_cow with AsciiDenyList::URL as the second argument. Note that this rejects IPv6 addresses, so before this, you need to check if the first byte of the input is b'[' and, if it is, treat the input as an IPv6 address instead.
Apps that need to display host names to the user should use uts46::Uts46::to_user_interface. The ToUnicode operation is rarely appropriate for direct application usage.
alloc - For future proofing. Currently always required. Currently, the crate internal may allocate heap but for typical inputs do not allocate on the heap (apart from the output String when applicable).compiled_data - For future proofing. Currently always required. (Passed through to ICU4X.)std - Adds impl std::error::Error for Errors {} (and implies alloc).By default, idna uses ICU4X as its Unicode back end. If you wish to opt for different tradeoffs between correctness, run-time performance, binary size, compile time, and MSRV, please see the README of the latest version of the idna_adapter crate for how to opt into a different Unicode back end.
domain_to_ascii_strict now performs the CheckHyphens check (matching previous documentation).Idna::to_ascii_inner method has been removed. It didn't make sense as a public method, since callers were unable to figure out if there were errors. (A GitHub search found no callers for this method.)compiled_data needs to be explicitly enabled.MIT OR Apache-2.0 for the code. Additionally, there is a test data file, IdnaTestV2.txt, under Unicode-3.0.