Hi Daniel,
Thanks for the reply.
Here is the code I tried but I am not able to make it work but as I said
earlier I can do "mget filename" from a konsole for that particular
filename.
ftp = new FTPClient();
ftp.connect(host);
ftp.setControlEncoding("UTF-8");
ftp.setAutodetectUTF8(true);
ftp.enterLocalPassiveMode();
ftp.enterRemotePassiveMode();
ftp.login("xxxxxx", "xxxxxx");
System.out.println("Connected to " + host + ".");
System.out.print(ftp.getReplyString());
// After connection attempt, you should check the reply code to verify
// success.
reply = ftp.getReplyCode();
if(!FTPReply.isPositiveCompletion(reply)) {
ftp.disconnect();
System.err.println("FTP server refused connection.");
System.exit(1);
}
boolean ok = ftp.changeWorkingDirectory(pathname);
System.out.println("Change dir ok: " + ok) ;
InputStream is = ftp.retrieveFileStream(resource);
if(!FTPReply.isPositiveCompletion(reply=ftp.getReplyCode())) {
System.out.println("Reply===>" + reply);
is.close();
ftp.logout();
ftp.disconnect();
System.err.println("File transfer failed.");
System.exit(1);
}
// Must call completePendingCommand() to finish command.
if(!ftp.completePendingCommand()) {
ftp.logout();
ftp.disconnect();
System.err.println("File transfer failed.");
System.exit(1);
}
//reply = ftp.getReplyCode();
System.out.print("Stream1 status: " + ftp.getReplyString());
System.out.println("Stream: " + is);
The above code doesn't work. Can you tell me whether the above code has any
issues? The filename is "sozial-fähigen-Anwendungen.txt".
Will really appreciate if you can help me out.
Thanks
Susanta
On Thu, Jun 14, 2012 at 7:47 PM, Daniel F. Savarese <[email protected]>wrote:
>
> In message <
> cafl1cpp5gk8nw3gnvxqcs2ggpjrh_obadyvzcgcsxs8lc96...@mail.gmail.com>
> , Susanta Mohapatra writes:
> > InputStream is =3D ftp.retrieveFileStream(resource);
> > reply =3D ftp.getReplyCode();
> > System.out.print("Stream1 status: " + ftp.getReplyString());
> > System.out.println("Stream: " + is);
> >
> > InputStream is1 =3D ftp.retrieveFileStream("rssfeed1.xml");
> > System.out.print("Stream2 status: " + ftp.getReplyString());
> > System.out.println("Stream: " + is1);
>
> Your problem doesn't appear to have anything to do with character
> encodings (besides, ISO-8859-1--which contains the umlaut--used to be
> the default character encoding and has never presented any problems
> unless something has changed recently). Unless the API has changed
> while I haven't been paying attention, you need to call
> completePendingCommand after you're done using the InputStream
> before issuing any other command.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>