hello all
i got this error with my code:
Client is indy tcp client
{code}
with Client do
begin
try
IOHandler.DefStringEncoding := TIdTextEncoding.Unicode;
IOHandler.WriteLn(txtData.Text);
lstLog.Items.Add('sent data: [' + txtData.Text + ']');
except
lstLog.Items.Add('failed to send data [' + ip + ']');
Client.Disconnect();
lstLog.Items.Add('Disconnect with ' + txtServer.Text + ' !');
BtnConnect.Enabled := True;
BtnSend.Enabled := False;
btnDisconnect.Enabled := False;
end;
end;
{code}
error:
{code}
[dcc32 Error] Unit6.pas(83): E2003 Undeclared identifier: 'TIdTextEncoding'
{code}
i just have to send unicode string to the indy tcp server..
what is wrong with my code?!
regards
P.S. :
when i hide the line :
{code}
// IOHandler.DefStringEncoding := TIdTextEncoding.Unicode;
{code}
compiler can done its work and the output application will work good with English chars , but it convert utf8 chars to ?
Vote for best question.
Score: 0
# Vote: 0
Date Posted: 15-May-2014, at 8:46 AM EST
From: peiman f
Re: get error Undeclared identifier: 'TIdTextEncoding' with
> Which versions of Delphi and Indy are you using?
i use delphi xe5 and indy 10.6.0.5040
so
i changed my code to :
{code}
IOHandler.DefStringEncoding := IndyTextEncoding_UTF8;
{code}
And problem resolved!!
but indy have poor knowledge or manual and samples on the web and this make a lot of problems ...
thank you sir.
Vote for best answer.
Score: 5
# Vote: 1
Date Posted: 15-May-2014, at 12:53 PM EST
From: peiman f
Re: get error Undeclared identifier: 'TIdTextEncoding' with
> Then TIdTextEncoding does not exist, use IIdTextEncoding instead.
how?
i used :
{code}
IOHandler.DefStringEncoding := IndyTextEncoding_UTF8;
{code}
and worked good for me
but how can i use IIdTextEncoding
this have error in my ide:
{code}
IOHandler.DefStringEncoding := IIdTextEncoding.UTF8;
{code}