Repository navigation
Fix ASCII validation issues, add support for international domain names - #19
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes some longstanding validation issues (list at the end below). It also adds support for converting internationalized domain names to ASCII according to IDNA2008, including the host of a URL and the domain of an email address.
Important
As a result of these fixes, some strings which used to validate in earlier versions may not pass validation going forward:
https://orfile:///path)--in the third and fourth positions of a label, unless the label is a valid A-label (xn--…)url-string->asciito convert them)mint-tag-uri) that contain uppercase letters, and email authorities with characters other thana–z,0–9,-,.and_before the@. A feed that uses such an authority will need new IDs, and feed readers may show its entries again.A preview of the documentation updates in this PR is live at https://joeldueck.com/what-about/splitflap/. In particular, see:
Changes
dns-domain?now allows labels that start with a digit (per RFC 1123) and labels of up to 63 bytes; limits domains to 253 bytes; and no longer accepts the empty string. As a result,valid-url-string?no longer accepts URLs with an empty host.email-address?now checks the entire local part (previously one allowed character was enough), and it now applies exactly the same rules asvalidate-email-address. Both accept uppercase letters and`, and both reject local parts that start or end with a period or contain two periods in a row.Added
tag-authority?.mint-tag-urinow requires a lowercase authority, and allows onlya–z,0–9,-,.and_before the@of an email authority, per RFC 4151. The W3C Feed Validator rejects Atom feeds whose tag URIs use other authorities.Added
domain->ascii,url-string->asciiandemail-address->ascii, which convert internationalized domain names to ASCII according to IDNA2008 (see Internationalized domain names).url-string->asciialso percent-encodes any other non-ASCII characters, following RFC 3987.email-address->asciiconverts only the domain, because a non-ASCII local part has no ASCII form.dns-domain?now requires labels with--in the third and fourth positions to be valid A-labels, andvalid-url-string?now rejects URLs that contain non-ASCII characters. The IDNA code and tables are loaded only when a domain name contains a non-ASCII orxn--label.The MIME type table (
mime-types-by-ext) is now loaded the first time it is used, rather than whenever Splitflap is loaded.Corrected the docs for
dns-domain?(length limits) and for the email functions (length limits, allowed characters, and the result ofvalidate-email-address).Closes #14
Closes #15
Closes #16
Closes #17
Closes #18