If you dont want to save your data, then you can load the file into a TMemoryStream (or a string) and replace the #0 with another character.
This is only
unicode text, so the problem is not to replace those bytes, but to read the file with correct encoding.
If one did it this way and there is only one real
unicode character inside, one would get really strange results...
Even if there is no byte order mark this code works perfectly for me:
Delphi-Quellcode:
var
test: TStringStream;
begin
test := TStringStream.Create('', TEncoding.Unicode);
try
test.LoadFromFile('c:\temp\a.txt');
ShowMessage(test.DataString);
finally
test.Free;
end;
end;
So it would be better, if you would attach a working sample code with an example file...