[Lazarus] Unicode on Windows
Jürgen Hestermann
juergen.hestermann at gmx.de
Mon Apr 9 19:23:08 CEST 2012
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.
More information about the Lazarus
mailing list