W3C home > Mailing lists > Public > www-international@w3.org > July to September 2008

Re: Weird bidi behavior?

From: Najib Tounsi <ntounsi@emi.ac.ma>
Date: Fri, 29 Aug 2008 21:41:15 +0000
Message-ID: <48B86CFB.7000101@emi.ac.ma>
To: Richard Ishida <ishida@w3.org>
CC: 'Martin Duerst' <duerst@it.aoyama.ac.jp>, www-international@w3.org

Hello Martin, Richard, others,

Richard Ishida wrote:
> Hmm. I couldn't think of anything.  Interesting that it does the same if you
> have a space inside the span after the period. 

Try a space after the span element. The behavior is even weirder. Could 
someone please repeat the experience of adding space after </span>?

Martin's original html: 
http://www.sw.it.aoyama.ac.jp/2008/pub/bidi-test.html (downloaded to 
http://196.200.140.8/Tests/bidi-test-original.html )

Same file with space after </span>: 
http://196.200.140.8/Tests/bidi-test-original-withSP.html

Now you get the right rendering with Firefox 3.0, SeaMonkey(mozilla) 
1.1.8, Opera 9.2.5. (But not with Safari 2.0.1 !? )


>  Also, I tried removing the
> period, but it made no difference.  I also got the same result on IE, Opera
> and Firefox, so it seems likely that it's following some rule in the
> algorithm.
>   


However, with some bidi "strange" behavior, it is in general difficult 
to say if it is the algorithm's fault or the implementation (user 
agent)'s one. Of course, with experience you can always use Ctrl 
charactères (&lrm; &rlm; RLE/LRE-PDF ...) to solve the problem. But it 
is preferable to have some general design rules (BPs?). For example, 
avoid to span over a mixed bidi text to give some property (green color 
here: <span style='color: green'>This is a ابةتث car.</span>), because 
of the differences between the logical and the visual order.

As a recent example, this time it was a mozilla/Firefox (big) bug. Fixed 
with version firefox3. In bidi texts, a word A may be at some place in 
the logical order (i.e. adjacent to another word B), and jump to another 
place in visual order (i.e. separated from word B).

Example (see also [3]):
Logical: latin1 latin2 CIBARA1 CIBARA2 latin3
Visual: latin1 latin2 2ARABIC 1ARABIC latin3
(Assuming LTR context)

The two  words CIBARA2 and latin3 which were adjacent, are now separated 
(case-1 of [3]).
Now what about a link text of "CIBARA2 Latin3"? The visual effect is 
that the same link has it's text link separated in two (the rtl and ltr) 
parts. (case-2 of [3]).
This is not a bug. Only an odd visual effect, which might be misleading, 
and make someone think of two different links.

But imagine that CIBARA1 (the word between, in visual order) is also a 
link. (case-3 of [3]). A bug in Firefox2 and mozilla make that the 
former link override the latter one, which then cannot be accessed. This 
bug has been fixed in Firefox3. But might exist for other UA.

Note that adding dir="rtl" to the html tag "solves" the three cases.(See 
[4])

In fact, this issue existed in a real situation in an Arabic page with 
people using firefox2. Adding the BP dir="rtl" to the html tag, solved 
the problem. But the problem might exist for Latin pages with some RTL 
text inside.

To summarize, beside the BP of adding dir="rtl" to the html tag of a 
page whose primary language is RTL, it might be useful to try to avoid 
having a mixed bidi text in an inline block with a property which can 
have a visual effect (color, link etc.) . At least at present time.

Any opinion?

Best regards, Najib


[1] http://196.200.140.8/Tests/bidi-test-original.html 
(http://www.sw.it.aoyama.ac.jp/2008/pub/bidi-test.html)
[2] http://196.200.140.8/Tests/bidi-test-original-withSP.html

[3] http://196.200.140.8/Tests/mixed-bidi-link.html
[4] http://196.200.140.8/Tests/mixed-bidi-link.bis.html

> RI
>
> ============
> Richard Ishida
> Internationalization Lead
> W3C (World Wide Web Consortium)
>
> http://www.w3.org/International/
> http://rishida.net/
>
>
>
>   
>> -----Original Message-----
>> From: www-international-request@w3.org [mailto:www-international-
>> request@w3.org] On Behalf Of Martin Duerst
>> Sent: 27 August 2008 11:44
>> To: www-international@w3.org
>> Subject: Weird bidi behavior?
>>
>>
>> Can somebody explain the bidi behavior of Case 2 at
>> http://www.sw.it.aoyama.ac.jp/2008/pub/bidi-test.html ?
>> The only difference between Case 1 and Case 2 is that
>> Case 2 uses dir='ltr' on the green <span>.
>>
>> Regards,    Martin.
>>
>>
>> #-#-#  Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University
>> #-#-#  http://www.sw.it.aoyama.ac.jp       mailto:duerst@it.aoyama.ac.jp
>>     
>
>
>
>
>   

-- 
Najib TOUNSI (mailto:tounsi @ w3.org)
W3C Office Morocco (http://www.w3c.org.ma/)
Ecole Mohammadia d'Ingenieurs, BP 765 Agdal-RABAT Maroc (Morocco)
Phone : +212 (0) 37 68 71 50 (P1711)  Fax : +212 (0) 37 77 88 53
Mobile: +212 (0) 61 22 00 30 
Received on Friday, 29 August 2008 20:40:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 2 June 2009 19:17:18 GMT