[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need BIDI help



Salam Alikom,

Quoting Khalid Farouq <sssunnn at gmail dot com>:

Salamo Alikom,
I'm localizing reports written in C. The code creates a "line" by inserting
tokens into a string (let us call it Buffer). When several Arabic words come
next to each other, this part of the line is reversed. I tried to separate
each word by an english letter "e", and it worked. But "e" will appear in
the report which is unacceptable.

I traced the problem and found the following:
Let us declare "Buffer" as a string, Initialize it as follows:
Buffer="eaaaaebb"
"Memory"----15432687

Where "e" means English character(Left to right), "a" means Arabic word
(Right to left), and "b" means another arabic word. I found that the place
of each character in the array is as shown in the "Memory" line.

So it deals with the arabic charaters from right to left.

If I removed the second "e", the string is totally reversed(But "e" will
remain unchanged)
remove middle "e"
Buffer="eaaaaebb" ---------------------> Buffer="ebbaaaa"
"Memory"----15432687 "Memory"----1765432

I need to have the "bb" to be in the same place before removing "e" i.e. to
the right of "aaaa".

Is there any "Left to right" character that can be put instead of "e", but I
need that this character doesn't have any graphical presentation (I need it
to be something like "space"). I tried "spcae" and most of the charaters in
the ASCII table but they don't affect the orientation.
*I was told (By brother Ahmad Khalifa )to add the the Left to Right
Override(LRO), its Code is \u202D. But each time I add it the C compiler
says that \u is an unknown sequence. Can any one tell me how to insert a
unicode character in a string or by wprintf()*

I recommend you try using the Unicode editor Yudit (http://www.yudit.org). This
editor
even has buttons for putting in the Unicode directional override code points
such as LRO. By default, files are saved in UTF-8 format. Among many hundreds
of keyboard layouts (including of course several Arabic keyboards) there is also
a Unicode keyboard layout, so you can type "u+0202d" and the editor will insert
the UTF-8 equivalent directly.


Yudit is very convenient and I highly recommend you try it. I use Yudit to type
in Unicode UTF-8 strings directly into C and C++ code all of the time. (I just
use normal ANSI C "char *" or C++ standard library "std::string" containers for
the UTF-8 strings. In modern UTF-8-based Linux locales, this always just works.
I assume this is what you are doing too).


ma salaame,

- Ed Trager