You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Daniel F. Savarese" <df...@savarese.org> on 2006/02/17 20:41:44 UTC

Re: [Help] FTP of files with non english file names

In message <BA...@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