Marcos Douglas schrieb:
> Lenght function do not works with UTF8 correctly.
> procedure TForm1.Button1Click(Sender: TObject);
> begin
>   Edit1.Text := 'ábç';
>   ShowMessage(IntToStr(Length(Edit1.Text)));
> end;
> The result is 5 not 3, but you did know this of course.


Yes. For Unicode encoding we would need new functions to distinguish between number of bytes and number of (visible) glyphs:

LengthInBytes()
LengthInGlyphs()

because sometimes you need the first and sometimes (but seldom) you need the latter. For one byte encodings both are identical but not for Unicode. Just think of LENGTH as beeing the first version.

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to