Más avances.
Si codifico el txt como UTF8 (guardar como) es cuando detecta los caracteres iniciales.
Si lo codifico Annsi, no me reconoce caracteres al inicio y la linea (Registro) se ve correcta, pero el código no hace sl.Add, peta y da access violation
Codigo modificado:
Código Delphi
[-]begin
if opendialog1.Execute then
begin
AssignFile(Datos, OpenDialog1.FileName);
Reset(Datos);
CaracteresIgnorar := 0;
PrimeraLinea:=True;
sl:=TStringList.Create; try
while not EOF(Datos) do
begin
ReadLn(Datos, Registro);
if (PrimeraLinea) then
begin
if (Ord(Registro[1]) = $EF) and (Ord(Registro[2]) = $BB) and (Ord(Registro[3]) = $BF) then
CaracteresIgnorar := 3;
Registro := copy(Registro,CaracteresIgnorar, Length(Registro));
end;
sl.Add(Registro); next;
end; sl.SaveToFile('C:\Rebuts_1.0\Fitxers\Ranking\FicheroTemporal.txt');
finally
end;
end;
end;
No se si todo el código de pruebas esta correctamente realizado.
Esta variable sl se debe inicializar?
Por esto da access violation?
Saludos
Josep