× Components and Libraries for Networking Development, discussions, problems and suggestions

Question Indy UDP Server: how to send/receive a non-english string?

  • Roman
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 weeks 4 days ago #15389 by Roman
I am using TIdUDPserver to send and receive strings. The transmission and reception of strings is carried out on one computer in different applications.

Sending I do this:
procedure TForm1.Broadcast(Msg : String; Param : string);
begin
  if Param <> '' then
    Msg += ':' + Param;
  if UDP.Active then
    UDP.Broadcast(Msg, 9999);
end;
UDP is TIdUDPserver component.

Reception I do this:
procedure TForm1.UDPUDPRead(AThread : TIdUDPListenerThread; const AData : TIdBytes; ABinding : TIdSocketHandle);
begin
  case ABinding.Port of
    9999:
      Label1.Caption := BytesToString(aData);
  end;
end;

Everything works as long as I use English text. If I send Russian text, I receive garbage:
Sent 'Hello!' --- Received 'Hello!'
Sent 'Привет' --- Received '??????'

I don't understand where, when and how does Indy recode the strings? What should be done to transmit / receive strings without problems?

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
3 weeks 4 days ago - 3 weeks 4 days ago #15391 by Sternas Stefanos
Replied by Sternas Stefanos on topic Indy UDP Server: how to send/receive a non-english string?
Thanks Sir
please any test project ?
and
your CT version, your OS, etc.

PilotLogic Architect and Core Programmer
Last edit: 3 weeks 4 days ago by Sternas Stefanos.

Please Log in or Create an account to join the conversation.

  • Roman
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 weeks 3 days ago #15396 by Roman
I am attaching a test project.

File Attachment:

File Name: TEST.zip
File Size:5 KB


OS: Windows 10, build 10.0.18362 (Tested on the Windows 7 system - the same result)

Attachments:

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
3 weeks 3 days ago #15397 by Sternas Stefanos
Replied by Sternas Stefanos on topic Indy UDP Server: how to send/receive a non-english string?
Thanks Sir
please give us time to test

PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.