@@ -47,11 +47,12 @@ pub mod uts46;
47
47
///
48
48
/// This process may fail.
49
49
pub fn domain_to_ascii ( domain : & str ) -> Result < String , uts46:: Errors > {
50
- uts46 :: to_ascii ( domain , uts46:: Flags {
50
+ let flags = uts46:: Flags {
51
51
use_std3_ascii_rules : false ,
52
52
transitional_processing : false ,
53
53
verify_dns_length : false ,
54
- } )
54
+ } ;
55
+ uts46:: Config :: from ( flags) . check_hyphens ( false ) . to_ascii ( domain)
55
56
}
56
57
57
58
/// The [domain to Unicode](https://url.spec.whatwg.org/#concept-domain-to-unicode) algorithm.
@@ -63,11 +64,12 @@ pub fn domain_to_ascii(domain: &str) -> Result<String, uts46::Errors> {
63
64
/// This may indicate [syntax violations](https://url.spec.whatwg.org/#syntax-violation)
64
65
/// but always returns a string for the mapped domain.
65
66
pub fn domain_to_unicode ( domain : & str ) -> ( String , Result < ( ) , uts46:: Errors > ) {
66
- uts46 :: to_unicode ( domain , uts46:: Flags {
67
+ let flags = uts46:: Flags {
67
68
use_std3_ascii_rules : false ,
68
69
69
70
// Unused:
70
71
transitional_processing : false ,
71
72
verify_dns_length : false ,
72
- } )
73
+ } ;
74
+ uts46:: Config :: from ( flags) . check_hyphens ( false ) . to_unicode ( domain)
73
75
}
0 commit comments