function WideStringToDisplay(mWideString: WideString): string;
var
  I: Integer;
  S: string;
begin
  Result := '';
  S := '';
  for I := 1 to Length(mWideString) do
    if Ord(mWideString[I]) in [32..127] then
      S := S + mWideString[I]
    else begin
      if S <> '' then begin
        Result := Result + QuotedStr(S);
        S := '';
      end;
      Result := Result + Format('#$%x', [Ord(mWideString[I])]);
    end;
  if S <> '' then Result := Result + QuotedStr(S);
end; { WideStringToDisplay }