Skip to content

Apply CheckBidi to every label in a Bidi domain - #107

Draft
anonrig wants to merge 2 commits into
mainfrom
cursor/idna-regressions-and-tests-5a26
Draft

anonrig wants to merge 2 commits into
mainfrom
cursor/idna-regressions-and-tests-5a26

Conversation

@anonrig

@anonrig anonrig commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Summary

CheckBidi (RFC 5893) applies to every label once a domain contains an RTL label. to_ascii validated Bidi only for labels that themselves contained R, AL, or AN, and it skipped all-ASCII labels, so 1.ا and ا.1a were accepted. Those labels now fail rule 1. An LTR label that starts with L and ends with L or EN, such as example.ا, still converts.

The Hangul LV+T NFC fast path (U+AC00 U+11A8 composes to U+AC01, xn--p39a rather than xn--rud7310f) and the ContextJ loop (a joiner must not return before later joiners and CheckBidi run; ZWNJ must sit between joining types L/D and R/D) are covered by regression tests against UTS #46 / IdnaTestV2 and the WPT toascii.json fixture.

Fixes #104

Reported by Ömer Akalın (@otaliptus) and Hayder Tirmazi (@jadidbourbaki) in idna#104.
The CheckBidi gap was reported by Mert Can Altin (@mertcanaltin) in ada-url/ada#1277.

Test plan

  • ctest in ada-url/idna (IdnaTestV2, WPT toascii, Hangul LV+T, ContextJ, Bidi-domain cases)
  • CI
Open in Web Open in Cursor 

cursoragent and others added 2 commits October 12, 2026 02:37
Regression tests covering:
- #104: Hangul LV syllable followed by trailing consonant
  composing to LVT syllable under NFC (U+AC00 U+11A8 -> U+AC01)
- ada-url/ada#1277: RFC 5892 ContextJ adjacency and RFC 5893 CheckBidi
  validation in labels containing joiners (ZWNJ/ZWJ)

Fixes #104

Reported by Ömer Akalın (@otaliptus) and Hayder Tirmazi (@jadidbourbaki) in idna#104.
Reported by Mert Can Altin (@mertcanaltin) in ada#1277.

Co-authored-by: Yagiz Nizipli <anonrig@users.noreply.github.com>
RFC 5893 applies its six conditions to every label once the domain contains
an RTL label. ASCII labels such as "1" in "1.ا" were skipped, so ToASCII
accepted hostnames that UTS #46 rejects.

Regression tests also lock Hangul LV+T composition under NFC
(U+AC00 U+11A8 -> xn--p39a) and ContextJ checks that must not skip a later
joiner or the Bidi rule.

Fixes #104

Reported by Ömer Akalın (@otaliptus) and Hayder Tirmazi (@jadidbourbaki).
The CheckBidi gap was reported by Mert Can Altin (@mertcanaltin) in
ada-url/ada#1277.

Co-authored-by: Yagiz Nizipli <anonrig@users.noreply.github.com>
@cursor cursor Bot changed the title test: add regression tests for Hangul NFC composition and ContextJ/Bidi validation Apply CheckBidi to every label in a Bidi domain Oct 12, 2026
@anonrig

anonrig commented Oct 12, 2026

Copy link
Copy Markdown
Member Author

Vendored into ada in ada-url/ada#1318.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NFC: Hangul LV syllable + trailing jamo (e.g. U+AC00 U+11A8) is not composed

2 participants