Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Mar : Re: TIdCmdTCPServer - how to communicate widestring data? (Delphi7)
| Subject: | Re: TIdCmdTCPServer - how to communicate widestring data? (Delphi7) |
| Posted by: | "Maxim Shiryaev" (maximshirya..@mail.ru) |
| Date: | Thu, 23 Mar 2006 00:05:53 |
Thank you very much.
Now will try to teach my .NET client to encode unicode to UFT8 and pass it
as Encoding.ANSI to the StreamWriter.
So I mean all the traffic will remain ANSI but will contain UTF8-encoded
data.
Maxim.
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> сообщил/сообщила в новостях
следующее: news:4421b395$1@newsgroups.borland.com...
>
> "Maxim Shiryaev" <MaximShiryaev@mail.ru> wrote in message
> news:4421a0e0@newsgroups.borland.com...
>
> > I need to communicate widestring data between my client
> > and TIdCmdTCPServer. I understand that RFC protocol is ANSI only, is it?
>
> Most protocols defined in RFCs are Ansi only, yes. However, there is
> nothing stopping you from implementing your own protocol manually, which
> would allow you to send anything you want.
>
> > I'm looking for a recommended way to pass widestring data in
> > all placess: command paramenters, replies and responses.
>
> Sorry, but WideString is not supported for those. If you must send
> WideString data as-is, then you will have to change your design. On the
> server side, you will have to use TIdTCPServer instead of TIdCmdTCPServer,
> using the OnExecute event to read/write all of the data manually. On the
> client side, you will have to ignore SendCmd() and LastCmdResult
completely,
> using the ReadBytes() and Write(TIdBytes) methods to send WideString data
in
> its raw form.
>
> > I know that I can encode everything in BASE64 in parameters and replies.
>
> That is one option. A better option would be to use UTF-8 instead. Most
> systems nowadays use UTF-8 for Unicode support, especially when using
> Ansi-based protocols since UTF-8 is compatible with Ansi.
>
> > What is the most standard way?
>
> There is no single standard way. There are many different ways to
> accomplish what you are asking for.
>
> > And more. My server should work with .NET client (non-Indy).
>
> All .NET strings are Unicode. Under .NET, Indy sends WideString values as
> Ansi by default, which will lose data if your strings contain non-Ansi
> characters. Indy does support sending strings as UTF-8 under .NET, but
you
> have to manually read/write the strings as TIdBytes in order to specify
the
> encoding (Ansi or UTF-8). Complete UTF-8 support is very minimal in Indy
10
> at the moment, but usuable under some circumstances.
>
>
> Gambit
none