Hi folks. We had a rather nasty problem with the ant FTP task. We needed some encoding conversion from the developers workstations To the FTP server which runs on an IBM mainframe the desired encoding was cp1047 which is not supported (we arent sure if ist really the desired encoding since the mainframe guys werent to clear about which of those 3 or 4 encodings they use on the machine is what we would need). The standard solution used in manual ftp transfers is to submit a 'site' command pointing to the appropriate conversion table on the host. This wasnt possible with ant. Its a minor modification and ive done it to solve our problem. I propose to change the FTP class accordingly since there are probably others which would need such functionality.
Below are the changes. I have the whole change ftp source too, if this would be more convenient. The code isnt thoroughly tested but works. Thanks for ant, folks. Great to know youre out there. Dan 8<-------------8<-------------cut here-------------8<-------------8< ... private String initialCommands = null; ... /** * sets commands which are executed in order after the * connection has been established. */ public void setInitialcommands(String initialCommands) { this.initialCommands = initialCommands; } ... public void execute() throws BuildException { ... log("login succeeded", Project.MSG_VERBOSE); // new code if (initialCommands != null) { Vector cmds = StringUtils.split(initialCommands, ';'); for (int i = 0; i < cmds.size(); i++) { doSiteCommand(ftp, (String) cmds.get(i)); } } // end new code if (binary) { ... }