[Fribidi-discuss] What length should I expect in fribidi functions?
behdad at behdad.org
Mon Aug 5 22:59:01 EST 2002
On Mon, 5 Aug 2002, Yedidyah Bar-David wrote:
> I declared variables of length FRIBIDI_MAX_STRING_LENGTH in a library
> that uses fribidi (the babylon parser of wordtrans). Now, in one of
> the latest versions of fribidi, FRIBIDI_MAX_STRING_LENGTH became too
> large to allocate beforehand.
FRIBIDI_MAX_STRING_LENGTH is the maximum length of a string that=20
fribidi supports, it should not be used for allocations.
> I have a string in ISO8859-8. I want to convert it to unicode, then do
> log2vis, then back to ISO8859-8.
> What length temporary arrays should be? can charset-to-unicode
> make it more than 4 times bigger? 6 times? More than that?
> Is it documented anywhere?
The charset-to-unicode converts strings to UTF-32, not UTF-8, it=20
means that the output needs exactly sizeof(FriBidiChar) times=20
longer memory, which is 4 times by default. to convert a buffer=20
char buf, you need to define a FriBidiChar out=20
> In utf-8(7), it says:
> * UTF-8 encoded UCS characters may be up to six bytes
> long, however the Unicode standard specifies no charac=AD
> ters above 0x10ffff, so Unicode characters can only be
> up to four bytes long in UTF-8.
Behdad Esfahbod 15 Mordad 1381, 2002 Aug 6=20
http://behdad.org/ [Finger for Geek Code]
#define is_persian_leap(y) ((((y)-474)%2820+2820)%2820*31%128<31)
More information about the FriBidi