TStringList.LoadFromFile read utf8 Preamble to first line.
Original Reporter info from Mantis: henrynj
-
Reporter name: hangyongdong
Original Reporter info from Mantis: henrynj
- Reporter name: hangyongdong
Description:
procedure TForm1.Button1Click(Sender: TObject);
var
ts: TStringList;
str: string;
begin
ts := TStringList.Create;
ts.LoadFromFile('utf8.ini');
str := ts[0]; //'[string]'
if copy(str,1,1) = '[' then //I except '[' but it is UTF8 Preamble. str[0]=$EF str[1]=$BB str[2]=$BF. Is there a FPC bug?
ShowMessage(str);
ts.free;
end;
Additional information:
TMemIniFile, TIniFile using TStringList, have the same bug.
Mantis conversion info:
- Mantis ID: 24385
- OS: Windows XP
- OS Build: sp3
- Version: 2.6.2
- Fixed in version: 3.0.0
- Fixed in revision: 26865 (#526d84fd)
- Monitored by: » Dirk Jansen (Dirk Jansen)