[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [idn] IDNA questions
> The IDNA spec does not require applications to actually perform ToASCII
> and actually perform a case-insensitive ASCII comparison when comparing
> labels. It merely requires applications to use a procedure that yields
> the same answer as that procedure. One procedure that meets the
> requirement is to perform a modified ToASCII that always outputs lower
> case everything, and then perform an exact comparison.
>
> Would you like us to mention that optimization in the spec? We have
> generally decided not to describe optimizations in the spec, but rather
> let the spec define correct externally-visible behavior and not concern
> itself with internal implementation issues.
In general I don't think the spec needs to list all possible optimizations.
But the fact that the spec says
3) Whenever two labels are compared, they MUST be considered to
match if and only if their ASCII forms (obtained by applying ToASCII)
match using a case-insensitive ASCII comparison.
it would be helpful to point out that this doesn't require applying
ToASCII for every comparison.
> Be careful. Comparing ToUnicode(X) with ToUnicode(Y) is not a
> valid comparison of X and Y, because the output of ToUnicode is not
> necessarily nameprepped. An exact comparison of Nameprep(ToUnicode(X))
> and Nameprep(ToUnicode(Y)) is the same as a case-insensitive ASCII
> comparison of ToASCII(X) and ToASCII(Y) when X and Y are valid labels.
I think this makes sense pointing out in the above text.
> But when X and Y are invalid, the former comparison might return a match
> when the latter comparison would not (because ToASCII would fail). If
> you don't care about the result of comparing two invalid labels (and I
> suppose you often wouldn't), then you could use the former comparison.
Erik