Files with UTF8+BOM are not parsed, I had to include thhis in my code:
function LoadFileWithoutBOM(const FileName: string): string;
var
Bytes : TBytes;
Start : Integer;
begin
Bytes := TFile.ReadAllBytes(FileName);
Start := 0;
// UTF-8 BOM = EF BB BF
if (Length(Bytes) >= 3) and
(Bytes[0] = $EF) and
(Bytes[1] = $BB) and
(Bytes[2] = $BF) then
Start := 3;
Result := TEncoding.UTF8.GetString(Bytes, Start, Length(Bytes) - Start);
end;
Files with UTF8+BOM are not parsed, I had to include thhis in my code:
function LoadFileWithoutBOM(const FileName: string): string;
var
Bytes : TBytes;
Start : Integer;
begin
Bytes := TFile.ReadAllBytes(FileName);
Start := 0;
// UTF-8 BOM = EF BB BF
if (Length(Bytes) >= 3) and
(Bytes[0] = $EF) and
(Bytes[1] = $BB) and
(Bytes[2] = $BF) then
Start := 3;
Result := TEncoding.UTF8.GetString(Bytes, Start, Length(Bytes) - Start);
end;