当前位置:网站首页>delphi10 ftp文件名乱码问题

delphi10 ftp文件名乱码问题

2022-06-21 06:12:00 LBREN_

困扰了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;

原网站

版权声明
本文为[LBREN_]所创,转载请带上原文链接,感谢
https://blog.csdn.net/lbren_/article/details/122330427