[Fribidi-discuss] What length should I expect in fribidi functions?

Yedidyah Bar-David didi at tau.ac.il
Mon Aug 5 23:09:01 EST 2002


On Tue, Aug 06, 2002 at 10:31:49AM +0430, Behdad Esfahbod wrote:
> On Mon, 5 Aug 2002, Yedidyah Bar-David wrote:
> 
> > Hello,
> > 
> > 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 
> 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 
> means that the output needs exactly sizeof(FriBidiChar) times 
> longer memory, which is 4 times by default.  to convert a buffer 
> char buf[1000], you need to define a FriBidiChar out[1000] 
> buffer.
> 
> > 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­
> >          ters  above  0x10ffff, so Unicode characters can only be
> >          up to four bytes long in UTF-8.
> > 
> > Thanks,
> > 
> > 	Didi
> 
> behdad

Thanks!

	Didi

> -- 
> Behdad Esfahbod		15 Mordad 1381, 2002 Aug 6 
> 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 mailing list