Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
15.5k views
in Java FTP by
hi:
I am a software engineer from China and I have just downloaded the latest version :edtFTPj-2.0.4.
It seems that the method uploadFile(localFileName, remoteFileName) in class FileTransferClient does not work if the parameter "remoteFileName" contains Simplified Chinese Characters,such as uploadFile("C:/demo.wmv", "哈哈.wmv").
Before invoking the uploadFile method I have invoked method getAdvancedSettings().setControlEncoding("GBK2312") as the API says.
Here below are my codes:
FileTransferClient ftp = new FileTransferClient();
try{
    ftp.setRemoteHost("192.168.1.101");
    ftp.setUserName("admin");
    ftp.setPassword("admin");
    ftp.connect();
    ftp.getAdvancedSettings().setControlEncoding("GBK2312");
   String localPath = "F:/";
   String localFileName = "Kings.without.crown.by.magiconeal.wmv";
   ftp.setContentType(FTPTransferType.BINARY);
   System.out.println("上传开始时间:"+ new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.ssssss").format(new Date()));
   System.out.println("文件大小:"+new File(localPath+localFileName).length()/(1024*1024)+"MB");
   ftp.uploadFile(localPath+localFileName, "中文演示.wmv");
  System.out.println("上传结束时间:"+ new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.ssssss").format(new Date()));

and the stack trace are below:
enterprisedt.net.ftp.FTPException: 550 /????.wmv: Cannot create file.
at enterprisedt.net.ftp.FTPControlSocket.validateReply(FTPControlSocket.java:1128)
at enterprisedt.net.ftp.FTPClient.initPut(FTPClient.java:2518)
at enterprisedt.net.ftp.FTPClient.putData(FTPClient.java:2577)
at enterprisedt.net.ftp.FTPClient.putStream(FTPClient.java:2310)
at enterprisedt.net.ftp.FTPClient.put(FTPClient.java:2195)
at enterprisedt.net.ftp.FTPClient.put(FTPClient.java:2281)
at enterprisedt.net.ftp.FileTransferClient.uploadFile(FileTransferClient.java:669)
at enterprisedt.net.ftp.FileTransferClient.uploadFile(FileTransferClient.java:643)
at demo.Edtftpj_FTPTransferClient.main(Edtftpj_FTPTransferClient.java:27)

By the way,I have just made anothoer demo using class FTPClient, it works fine with Simplified Chinese after I invoke FTPClient.setControlEncoding("GBK2312").
Thanks a lot !

13 Answers

0 votes
by (520 points)
I use jdk1.5. It supports utf-8 and other encodings
0 votes
by (162k points)
Please don't post the same issue on two threads. Keep it to the other thread.
0 votes
by (520 points)
Sorry sir, I'll keep it in the other thread.

Categories

...