Crates.io | idna |
lib.rs | idna |
version | 1.0.3 |
source | src |
created_at | 2016-03-27 08:55:20.657552 |
updated_at | 2024-11-04 09:47:25.663512 |
description | IDNA (Internationalizing Domain Names in Applications) and Punycode. |
homepage | |
repository | https://github.com/servo/rust-url/ |
max_upload_size | |
id | 4577 |
size | 923,457 |
idna
IDNA 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.