> The only thing remaining is the question "What is a valid URL?" but I'll leave this one for another time! Because it's a tough one.
Is it? According to https://www.w3.org/TR/2011/WD-html5-20110525/urls.html, a URL is a valid URL if at least one of the following conditions holds:
• The URL is a valid URI reference [RFC3986].
• The URL is a valid IRI reference and it has no query component. [RFC3987]
• The URL is a valid IRI reference and its query component contains no unescaped non-ASCII characters. [RFC3987]
• The URL is a valid IRI reference and the character encoding of the URL's Document is UTF-8 or UTF-16. [RFC3987]