I use Memo to show user some text and allow changing this. Untortunately I have problems with reading this text again from Memo using Lines object. There is part of my code:
procedure TForm1.FormCreate(Sender: TObject);
var plik: TextFile;
var s: string;
begin
AssignFile(plik, './pl.txt');
Reset(plik);
while not eof(plik) do
begin
Readln(plik, s);
Memo1.Lines.Add(s);
end;
CloseFile(plik);
end;
procedure TForm1.Button1Click(Sender: TObject);
var i: integer;
begin
for i:=0 to (Memo1.Lines.Count-1) do
ShowMessage(Memo1.Lines.Strings[i]);
end;
Can you see something invalid there? File pl.txt exists of course. The problem is that I get weird Messages from program, where there are polish letters in pl.txt. You can download source of my test program and pl.txt from
http://files.myopera.com/Zajec/usedonce/zajec.tar.bz2 (39KB).
P.S.
File pl.txt contains:
Teśt
óf
polish lettęrs
but messages I get from Lazarus are:
1) Teśt
2) f
3) null
4) null