Link to home
Start Free TrialLog in
Avatar of drama22
drama22

asked on

indy Tmemory stream non latin charcter issue

i am using following code to send text data that saved inside memory stream
MS := TMemoryStream(OutboundCmds.Objects[I]);
        if MS <> nil then
        begin
          AContext.Connection.IOHandler.LargeStream := true;
          AContext.Connection.IOHandler.Write(MS, 0, true);
        end;
      end;

Open in new window


its sends text data correctly if its in english

but if its in other language like arabic it comes questions marks like this "?????" what could be the issue ?

here is how i add text to memory stream

procedure TConnection.sendData;
var
  I: integer;
  SL: TStringList;
  MS: TMemoryStream;
begin
  MS := TMemoryStream.Create;
  try
      SL := TStringList.Create;
      try
    begin
        SL.Add('مرحبا');
      end;

       if (SL.Count > 0) then
        begin
          SL.SaveToStream(MS);
          MS.Position := 0;
        end;
      finally
        SL.Free;
      end;
  finally
    MS.Free;
  end;

end;

Open in new window

SOLUTION
Avatar of Ferruccio Accalai
Ferruccio Accalai
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial