3

I have problem with conversion strings to utf-8. I use standard Indy method for sending with conversion inside:

 AContext.Connection.IOHandler.writeln(Utf8Encode('ĄĘÓ'));

but the client reads them like '???' - 3f 3f 3f in hex (I checked it by using WireShark too).

I use Delphi XE and Indy 10.

Big thanks for any help.

~Artik

RRUZ
  • 134,889
  • 20
  • 356
  • 483
Artik
  • 803
  • 14
  • 36
  • 2
    I know I can use something like that: AContext.Connection.IOHandler.writeln('ĄĘÓ',TIdTextEncoding.UTF8); but what can I do to send TStringlist intead of ordinary string. Iteration by TStringlist elements doesn't bring solve in my situation. – Artik Jul 03 '13 at 19:15
  • 1
    There is a `TIdIOHandler.Write()` method overload for `TStrings` data, and it has an optional `TIdTextEncoding` parameter, eg: `AContext.Connection.IOHandler.Write(MyStringList, False, TIdTextEncoding.UTF8);` – Remy Lebeau Jul 04 '13 at 06:03

1 Answers1

3

I found solution for my problem, I think the simplest by using code like below:

uses
  IdGlobal;

begin
  aContext.Connection.IOHandler.DefStringEncoding := IndyTextEncoding_UTF8;
end;
Artik
  • 803
  • 14
  • 36