2016. 10. 21. 12:38 keltezéssel, Juha Manninen via Lazarus írta:
I do not want to think of where Length, Copy, Delete is good and where UTF8*
needed.

Well, you must think when coding. There is no shortcut. :)

BTW, if you are worried about Delphi compatibility there is now unit
LazUnicode available.

Delphi compatibility not needed for me, but I am a silly coder and don't understand why the wiki say you can use Length, Copy, Delete with UTF8. See two examples below. First is a Lazarus project with a simple editbox, if press á (Alt+160) the form caption show 2. The second example is a console project (in Lazarus also), if press á (Alt+160) then Enter see 1 as result. Same FCP same Lazarus. Why is there a difference in the result?

1.
procedure TForm1.Edit1Change(Sender: TObject);
begin
  Caption:=IntToStr(Length(Edit1.Text));
end;

2.
var
  s:string;

begin
  ReadLn(s);
  Write(Length(s));
  ReadLn;
end.

Gabor
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to