DefStringEncoding
is not a class property, which is why you cannot access it via the TIdIOHandler
class type like you attempted to do. It is an instance property instead, so you need a pointer to an instance of a TIdIOHandler
object.
In the OnCommand
events, you can reach the TIdIOHandler
object via the TIdCommand.Context.Connection.IOHandler
property.
If all of your commands and replies will use UTF-8 then it would be better to set DefStringEncoding
one time when a client connects to the server. You can do that in the OnConnect
event via the TIdContext.Connection.IOHandler
property.
As for GIdDefaultAnsiEncoding
, TIdIOHandler
only uses it when DefStringEncoding
is nil, which it is not by default (there is a TODO item to make TIdIOHandler
use GIdDefaultAnsiEncoding
when initializing DefStringEncoding
).