困扰了1个月,想尽无数转码方式,都没有成功,ftp服务是 IIS 用的是UTF8
idftp 设置
idftp.transferType一定要设置为ftBinary
当执行了connect执行一下
if idftp_Client.IsExtSupported('UTF8') then
begin
// 尝试非标准UTF-8扩展,许多服务器使用这个方法...
if idftp_Client.SendCmd('OPTS UTF8 ON') <> 200 then
begin
// 尝试 draft-ietf-ftpext-utf-8-option-00.txt...
if idftp_Client.SendCmd('OPTS UTF-8 NLST') <> 200 then
Exit;
end;
idftp_Client.IOHandler.DefStringEncoding := IndyTextEncoding(TEncoding.UTF8);
end;