日期:2014-05-20  浏览次数:20730 次

(ftp下载)挥泪求帮助。求大神帮助啊。万分感激。
最近做了个下载ftp上的文本。
当我指定要下载的目录时。怎么也指定不上去。
例如我要指定到/temporaryFolder/滨州市/目录
ftp.changeWorkingDirectory(remotePath);// 转到指定目录
FTPFile[] fs = ftp.listFiles(remotePath);
fs[0]=".";
fs[1]="..";
fs[2]="滨州市";
我在/滨州市/目录下放了三个文本文件。可怎么弄都指定不过去。。

求帮助。挥泪求帮助。
------解决方案--------------------
找到问题的解决办法了。如果我把滨州市 改成bZhouCity
String remotePath = "/temporaryFolder/bZhouCity/";
ftp.changeWorkingDirectory(remotePath );// 转到指定目录
System.out.println(remotePath);的结果为true
如果
String remotePath2 = "/temporaryFolder/滨州市/";
System.out.println(remotePath);的结果为false
问题虽然解决了。但不知道中文目录为什么转不过去。。。
------解决方案--------------------
 //下面三行代码必须要,而且不能改变编码格式,否则不能正确下载中文文件
ftp.setControlEncoding("GBK");
FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_NT);
conf.setServerLanguageCode("zh");

这个gbk,是ftp的操作系统有关系............