Bookmark Topic Watch Topic
  • New Topic

Uploading/Downloading Problem(For Japanese Filename)  RSS feed

 
Knob Khera
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
I'm using Apache commons.net API for FTP file Upload\Download.
The program(given below) is working fine(i.e uploading\Downloading)for ENGLISH Filename.But while Uploading/Downloading Japanese Filename the file name get junk..(i.e ???.txt)


Please suggest some solution::

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.SocketException;

import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;

public class FTPPutUpLoad {

public static void main(String[] args) throws IOException {
FTPClient ftp = new FTPClient();
try {
ftp.connect("myjavaserver.com");
} catch (SocketException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
ftp.login("abcd","abcd");
ftp.setFileType(FTP.ASCII_FILE_TYPE);

ftp.enterLocalActiveMode();
ftp.changeWorkingDirectory("dsr");

FileInputStream st = new FileInputStream(new File("D:\\Bugs\\Dem\\さんは書きま.txt")); //file path

File st2=new File("NOOP.txt");
String aa=st2.toString();
System.out.println(aa);

if(ftp.storeFile(aa, st)){//ftp.storeFile(aa,st)

ftp.disconnect();
st.close();

}




}
}


Thanks
bugs
 
Joe Ess
Bartender
Posts: 9439
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Welcome to the Javaranch, K. You must have missed our naming policy on your way in. In short, displayed names must be a real-sounding first and last name separated by a space. You can change your name here.
Also, please do not post the same question in multiple forums. I'm going to close this copy in order to prevent confusion and duplication of effort.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!