How to use
Unicode strings in streams? I need to save strings in binary stream - for this I'm using TStringStream, but string are stored as
ASCII.
Delphi-Quellcode:
var
S: TStringStream;
begin
S := TStringStream.Create;
S.Encoding.UTF8;
S.WriteString('象');
S.SaveToFile('C:\0.txt');
S.Free;
S := TStringStream.Create;
S.Encoding.UTF8;
S.LoadFromFile('C:\0.txt');
Caption := S.DataString;
S.Free;
end;