<div dir="ltr"><div class="gmail_default" style="font-family:"times new roman",serif">Alastair, thanks for finding it and bringing it up. I think you're right that the problem is in that the test generation code doesn't properly apply the bidi criteria to <b>all</b> the labels if <b>any</b> of the labels are RTL, but instead is probably just going on a label-by-label basis. Thankfully, it looks like ICU does handle it right, by your note. (The test file generation doesn't use the ICU code.)</div><div class="gmail_default" style="font-family:"times new roman",serif"><br></div><div class="gmail_default" style="font-family:"times new roman",serif">Could you please report this via <a href="http://www.unicode.org/reporting.html">http://www.unicode.org/reporting.html</a> so that we make sure that it is tracked and brought up to the UTC?</div><div class="gmail_default" style="font-family:"times new roman",serif"><br></div><div class="gmail_default" style="font-family:"times new roman",serif">Mark</div><div class="gmail_default" style="font-family:"times new roman",serif"><br></div><div class="gmail_default" style="font-family:"times new roman",serif"><div class="gmail_default"><br></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><font face="'times new roman', serif"><div style="background-color:transparent;margin-top:0px;margin-left:0px;margin-bottom:0px;margin-right:0px"><div></div></div><div style="background-color:transparent;margin-top:0px;margin-left:0px;margin-bottom:0px;margin-right:0px">Mark</div></font><div><div><font face="'times new roman', serif"><i><span style="font-style:normal"><i></i></span><i></i></i></font></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Thu, Jan 5, 2017 at 10:46 AM, Alastair Houghton <span dir="ltr"><<a href="mailto:alastair@alastairs-place.net" target="_blank">alastair@alastairs-place.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 4 Jan 2017, at 23:40, Markus Scherer <<a href="mailto:markus.icu@gmail.com">markus.icu@gmail.com</a>> wrote:<br>
><br>
> On Wed, Jan 4, 2017 at 2:28 AM, Alastair Houghton <<a href="mailto:alastair@alastairs-place.net">alastair@alastairs-place.net</a>> wrote:<br>
> RFC 5893 seems pretty clear to me, and the problem really is that the test vectors (which come from <a href="http://unicode.org" rel="noreferrer" target="_blank">unicode.org</a>) seem (to me) to be incorrect.<br>
><br>
> <a href="https://tools.ietf.org/html/rfc5893#section-2" rel="noreferrer" target="_blank">https://tools.ietf.org/html/<wbr>rfc5893#section-2</a> says "The following rule, consisting of six conditions, applies to labels in Bidi domain names."<br>
><br>
> That's what the ICU code does -- applying the rule to each label -- and I assume that's the basis for the test data.<br>
<br>
</span>Absolutely.  But the crucial part is “in Bidi domain names”.  That is, it applies to *all* labels that are part of a Bidi domain name, not just RTL labels.  It did not say “applies to RTL labels in Bidi domain names” and in fact even explicitly states that (in the first bullet point at the end of section 2):<br>
<br>
  ...Note that even LTR labels and pure ASCII labels have to be tested.<br>
<br>
Not to mention the fact that parts 5 and 6 of the rule apply specifically to LTR labels.<br>
<br>
So it’s quite clear that given the domain name “0à.א”, both “א” *and* “0à” need to be checked using the Bidi Rule.  Unless someone can explain why “0à” does not fail the test, surely we all agree that line 74 is incorrect:<br>
<span class=""><br>
> B;    0à.\u05D0;      ;       xn--0-sfa.xn--4db       #       0à.א<br>
<br>
</span>and similarly with line 93:<br>
<span class=""><br>
> B;    àˇ.\u05D0;      ;       xn--0ca88g.xn--4db      #       àˇ.א<br>
<br>
</span><span class="">> ICU does not currently check for multi-label bidi combinations.<br>
<br>
</span>I was a bit puzzled by this, because the code clearly does (both in the C++ and Java versions) and yet the online demo doesn’t appear to object to the above test cases.  So I wrote a quick test program against the C++ version of ICU 58.2 and fed it both test cases, and, sure enough, ICU agrees that there is a BiDi error in both of the above cases.<br>
<div class="HOEnZb"><div class="h5"><br>
Kind regards,<br>
<br>
Alastair.<br>
<br>
--<br>
<a href="http://alastairs-place.net" rel="noreferrer" target="_blank">http://alastairs-place.net</a><br>
<br>
<br>
</div></div></blockquote></div><br></div>