Re: [whatwg/url] Add Unicode ToASCII fallback for ASCII domains (PR #914)

@domenic commented on this pull request.

It might be worth considering making the fast-path normative, since that's what implementations are going to want anyway. Right now it appears like the spec code is trying to avoid calling Unicode ToASCII more than once, but that's not really a useful "optimization" since the actual implementation code will be quite different.

```
1. If beStrict is false and domain is an ASCII string:
   a. If Unicode ToASCII(domain, flags(false)) is failure, domain-to-ASCII validation error // obvious validation-error-only step
   b. result = ASCII-lowercase(domain)
2. Otherwise:
   a. result = Unicode ToASCII(domain, flags(beStrict))
   b. If result is failure: domain-to-ASCII validation error; return failure
3. If beStrict is false:
   a. If result is "": domain-to-ASCII validation error; return failure
   b. If result contains a forbidden domain code point: domain-invalid-code-point validation error; return failure
4. Return result
```

> -  with <i>domain_name</i> set to <var>domain</var>, <i>CheckHyphens</i> set to <var>beStrict</var>,
-  <i>CheckBidi</i> set to true, <i>CheckJoiners</i> set to true, <i>UseSTD3ASCIIRules</i> set to
-  <var>beStrict</var>, <i>Transitional_Processing</i> set to false, <i>VerifyDnsLength</i> set to
-  <var>beStrict</var>, and <i>IgnoreInvalidPunycode</i> set to false. [[!UTS46]]
-
-  <p class=note>If <var>beStrict</var> is false, <var>domain</var> is an <a>ASCII string</a>, and
-  <a>strictly splitting</a> <var>domain</var> on U+002E (.) does not produce any
-  <a for=list>item</a> that <a for=string>starts with</a> an <a>ASCII case-insensitive</a> match for
-  "<code>xn--</code>", this step is equivalent to <a>ASCII lowercasing</a> <var>domain</var>.
-
- <li><p>If <var>result</var> is a failure value, <a>domain-to-ASCII</a> <a>validation error</a>,
- return failure.
+  <p>If <var>result</var> is a failure value:
+
+  <ol>
+   <li><p><a>domain-to-ASCII</a> <a>validation error</a>.

```suggestion
   <li><p><a>Domain-to-ASCII</a> <a>validation error</a>.
```

maybe? Not sure, but it reads strangely as-is.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/pull/914#pullrequestreview-4464281954
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/url/pull/914/review/4464281954@github.com>

Received on Wednesday, 10 June 2026 04:04:02 UTC