commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel F. Savarese" <...@savarese.org>
Subject Re: [Help] FTP of files with non english file names
Date Fri, 17 Feb 2006 19:41:44 GMT

In message <BAY110-F3B0984E31913DABEBC31BB7FB0@phx.gbl>, "Muthukumar Arasu" wri
tes:
>I was able to narrow down the problem to storeFile and retrieveFile methods 
>in FTPClient, where one have to give the remote file name as a String. In my 
>case they are Chinese characters (GB18030) which gets garbled up at the 
>target machine. How should I pass such characters to these methods. Any help 
>would be appreciated.

If you're retrieving a file and the file name isn't being created properly,
then open an OutputStream for the destination file yourself usingthe desired
character encoding for the file name and use retrieveFileStream.  If it's
the file you're storing, you're out of luck because it's a server side issue.
The FTP standard does not have anything to say about the character encoding
of file names.  I believe the UTF-8 representation of the characters will
be sent so the proper byte sequence will likely be used at the other end, but
there's no guarantee the server side understands the character set, knows
anything about the encoding, or any tools like an FTP client understand
it, etc.

Unless a subsequent RFC specified a convention for the character encoding of
pathnames, here's what you're stuck with:

  file

         An ordered set of computer data (including programs), of
         arbitrary length, uniquely identified by a pathname.

  pathname

         Pathname is defined to be the character string which must be
         input to a file system by a user in order to identify a file.
         Pathname normally contains device and/or directory names, and
         file name specification.  FTP does not yet specify a standard
         pathname convention.  Each user must follow the file naming
         conventions of the file systems involved in the transfer.

  http://www.ietf.org/rfc/rfc959.txt

daniel

-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-| Sleep and The Traveller |-#-#-#-#-#-#-#-
    s a v a r e s e      # In distant lands, I hear the call of my home.
   software research     # Yet my work is not done.  My journey's just begun.
http://www.savarese.com/ #  -- http://www.sleepandthetraveller.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message