indy 10 tcpsever 和tcpclient 中文乱码解决

delphi10年前 (2016)发布 admin
905 0
indy10 你直接 client.iohandler.writeln('我是中文'); 
只會收到一堆亂碼,解法如下

uses idglobal ; 

發訊息 client.ophandler.writeln('我是中文',enUTF8) ; 

收訊息

在server的onExecute 事件
var
ReadStr :string ; 
begin
ReadStr := acontext.Connection.IOHandler.ReadLn(enUTF8);
end;

来源地址:http://delphi.ktop.com.tw/board.php?cid=30&fid=67&tid=99556

© 版权声明

相关文章