 end;

  Viewer.Mode := vbmodeText;
  Viewer.OpenStream(MS);
end;

procedure TFormView.LoadWideString(const S: WideString);
begin
  if not Assigned(MS) then
    MS := TMemoryStream.Create;

  MS.SetSize(Length(S) * 2);
  if S &lt;&gt; '' then
  begin
    MS.Position := 0;
    MS.WriteBuffer(S[1], Length(S) * 2);
  end;

  Viewer.Mode := vbmodeUnicode;
  Viewer.OpenStream(MS);
end;

procedure TFormView.EmptyViewer;
begin
  Viewer.OpenStream(nil);

  if Assigned(MS) then
    FreeAndNil(MS);
end;
</textarea>
<