TlkJSONstreamed.SaveToStream does not work in unicode
Brought to you by:
leon_kon
SizeOf(Char) must be added in the computation:
SizeOf(Char) = 1 byte in ascii
SizeOf(Char) = 1 word in unicode
class procedure TlkJSONstreamed.SaveToStream(obj: TlkJSONbase;
dst: TStream);
var
ws: string;
begin
if not assigned(obj) then exit;
if not assigned(dst) then exit;
ws := GenerateText(obj);
dst.Write(pchar(ws)^, length(ws)* SizeOf(Char));
end;