When I'm using cmd
to put a file into AS400, after connecting with ftp
, I went like this:
ftp cd /home
ftp prompt 1
ftp ASC
ftp QUOTE TYPE C 1252
ftp mput *
ftp bye
Everything is working fine. The file is well encoded. Now, when I'm trying to do the same in Java. I am able to put the file, but it is not well encoded. I'm really stuck. Could someone help me out..
This is my Java code:
FTP ftp = this.SABFTPConnection();
ftp.cd(sabConfig.getDirectory());
ftp.setDataTransferType(FTP.BINARY);
ftp.issueCommand("prompt 1");
ftp.issueCommand("ASC");
ftp.issueCommand("QUOTE TYPE C 1252");
File io = new File(file);
boolean done = ftp.put(io, io.getName());
if (done) {
Log.getLog(SABData.class).info("file "+ io.getName() +" successfuly uploaded");
collected = true;
}