Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Uploading/Downloading Problem(For Japanese Filename)  RSS feed

 
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
 
Bartender
Posts: 9509
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!