Can't download files with Arabic name with Java FTP client

删除回忆录丶 提交于 2019-12-01 12:03:29

You may need to use UTF-8 encoding. First thing to try is to call FTPClient.setAutodetectUTF8:

ftpClient.setAutodetectUTF8(true);

(call that before connecting)

That should fix the problem your question is about.


Once you resolve the file name issue, you will need to fix transfer mode issue. You are transferring binary files (PDF) in text mode.

You need to use binary mode:

ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!