Arabic and Hebrew: a (not so) itty BIDI rendering issue
Mon 24 Sep 2007, 11:01 PMTweet
by Ben Langhinrichs
Since one of the features of both CoexEdit 2.0 and Midas Rich Text 4.0 releases is better support for "right to left" languages such as Arabic and Hebrew, I have been doing some investigation of the bidirectional capabilities inside Notes. I have to say, I am somewhat dismayed. The Notes client has excellent right to left and bidirectional (aka BIDI) support, as you would expect from a product with active sales in Israel and various Arab countries, and a long history of multilingual support. But, as so often seems to be the case, the Notes to Domino rendering does not live up to the standards of the Notes client itself.
Here is a specific example to show you what I mean. It is taken from the news website http://www.alkhaleej.co.ae/ (I did a quick and dirty Google translation to make sure it was not about anything complete unacceptable or controversial) and I have shown it in four ways. The first is from the website itself. The second is after I copied and pasted into a notes 8.0.0 rich text field from Internet Explorer (unfortunately, Firefox does not handle Arabic well either, so don't copy and paste from Firefox if you are using right to left languages!). The third is when that Notes rich text is rendered by the Domino HTTP process. The fourth is when the Notes rich text is rendered by the Midas Rich Text LSX 4.0.
Right to left text (Arabic):
In case you have trouble seeing the differences, I have highlighted a couple below. These may seem minor, but the problem is that the text is not going from right to left at all, but is justified left (instead of right) and is simply Arabic going the wrong direction. Things actually get worse if you have a mixture of English and Arabic (that is the BIDI part), because the words get misordered. See the last image for a demonstration of that, and particularly look at the words before and after the "Arabic Interrupted".
Right to left text (Arabic) with highlighted issues:
Bidirectional text (English in the midst of Arabic):
So, for those few who make it this far, what leads to this lousy rendering? Is this a devlishly difficult issue requiring weeks of work to handle? Well, no, not really. Actually, it simply requires a couple of very small checks. To help out those in IBM who have not managed to handle this in the TWELVE YEARS that BIDI support has been in Notes, I'll give you a couple of hints.
1) If a paragraph has the PABFLAG2_BIDI_RTLREADING flag set in the Flags2 field, generate your DIV or P tag with a dir="rtl" inside the DIV or P tag.
2) If a text field has a signature of instead of SIG_CD_BIDI_TEXT instead of SIG_CD_TEXT, add a dir="rtl" inside the FONT or SPAN tag.
Midas does more because it handles right to left tables and CSS tags as well as standard font tags, and also handles importing from HTML to rich text with directionalitybut you don't have to get that fancy. These are really, really minor changes that could and should be added, but there doesn't seem to be anybody paying that much attention to HTML rendering. A shame, really.
Copyright © 2007 Genii Software Ltd.
What has been said:
619.1. Sean Bannister (23/10/2007 06:26 PM)
Ben, I think this post is causing your RSS feed to fail:
Whitespace is not allowed at this location.
Line: 58 Character: 94
619.2. Ben Langhinrichs (10/23/2007 07:34 PM)
Sean - It turns out I am not encoding the title. For the moment, I changed it to the word "and", but I'll make sure to fix that for future posts. Thanks! - Ben