|
|
@@ -50,7 +50,16 @@ pub use uts46::{Config, Errors};
|
|
|
///
|
|
|
/// This process may fail.
|
|
|
pub fn domain_to_ascii(domain: &str) -> Result<String, uts46::Errors> {
|
|
|
- uts46::Config::default().to_ascii(domain)
|
|
|
+ Config::default().to_ascii(domain)
|
|
|
+}
|
|
|
+
|
|
|
+/// The [domain to ASCII](https://url.spec.whatwg.org/#concept-domain-to-ascii) algorithm,
|
|
|
+/// with the `beStrict` flag set.
|
|
|
+pub fn domain_to_ascii_strict(domain: &str) -> Result<String, uts46::Errors> {
|
|
|
+ Config::default()
|
|
|
+ .use_std3_ascii_rules(true)
|
|
|
+ .verify_dns_length(true)
|
|
|
+ .to_ascii(domain)
|
|
|
}
|
|
|
|
|
|
/// The [domain to Unicode](https://url.spec.whatwg.org/#concept-domain-to-unicode) algorithm.
|
|
|
@@ -62,5 +71,5 @@ pub fn domain_to_ascii(domain: &str) -> Result<String, uts46::Errors> {
|
|
|
/// This may indicate [syntax violations](https://url.spec.whatwg.org/#syntax-violation)
|
|
|
/// but always returns a string for the mapped domain.
|
|
|
pub fn domain_to_unicode(domain: &str) -> (String, Result<(), uts46::Errors>) {
|
|
|
- uts46::Config::default().to_unicode(domain)
|
|
|
+ Config::default().to_unicode(domain)
|
|
|
}
|