You must be careful at which time in the "ftp process" you issue a command (the javadoc of most methods does tell this).
E.g. setting control encoding or UTF-8 auto detection must be done
before "connect" is called - because of that it does fail in your case;
the socket is already opened and setup is done in your example and you
are calling things "too late" to have an effect.
I did used you code and changed things like this:
FTPClient ftp = new FTPClient();
ftp.setAutodetectUTF8(true);
ftp.connect(host);
ftp.login("xx", "xx");
ftp.enterLocalPassiveMode();
ftp.setFileType(FTP.BINARY_FILE_TYPE);
....
String resource = "sozial-fähigen-Anwendungen.txt";
InputStream is = ftp.retrieveFileStream(resource);
reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply) && reply !=
FTPReply.FILE_STATUS_OK) {
System.out.println("Reply===>" + reply);
if(is != null) {
is.close();
}
....
console output:
Connected to $HOST.
200 Switching to Binary mode.
Change dir ok: true
Stream1 status: 226 Transfer complete.
Stream: org.apache.commons.net.io.SocketInputStream@79f6f296
Used commons-net-3.0.1 for this example.
Give this a try and report if it does work for you now too :-D.
kind regards
Torsten
smime.p7s
Description: S/MIME cryptographic signature
