function StreamReadUnicodeStr(Stream: TStream): UnicodeString;
var w: Word;
b: TBytes;
begin
w := StreamReadWord(Stream);
if w=0 then result := ''
else begin
SetLength(b,w_2);
Stream.ReadBuffer(b[0],w_2);
result := TEncoding.Unicode.GetString(b);
end;
end;
Workaround DKLang.pas:
function StreamReadUnicodeStr(Stream: TStream): UnicodeString; var w: Word; b: TBytes; begin w := StreamReadWord(Stream); if w=0 then result := '' else begin SetLength(b,w_2); Stream.ReadBuffer(b[0],w_2); result := TEncoding.Unicode.GetString(b); end; end;