Hi, +-From: "Oberhuber, Martin" <[EMAIL PROTECTED]> -- |_Date: Wed, 19 Sep 2007 11:47:37 +0200 _______________________ | |I'm wondering if anybody thought about the case yet where |I'd like to transfer files via Sftp, where the file names |Use non-ASCII foreign language characters, and the character |Encoding on the local system is different than the remote. | |Say, I want to transfer from a Windows box to a Linux box. |On Windows, my encoding is Cp1252 |On remote Linux, my encoding is UTF-8 |I want to transfer file "m,Mv(Bchte" | |Currently, channel always seems to encode Java Unicode Strings |With Platform default encoding (Cp1252 in my case). On the |Remote, file names will not appear as expected.
Yes, it is a bug/incompleteness of jsch. As far as I have understood, we have to send filenames in UTF-8 over sftp protocol. For example, its IETF draft[1] has said as follows, 8.1.1. Opening a File Files are opened and created using the SSH_FXP_OPEN message. byte SSH_FXP_OPEN uint32 request-id string filename [UTF-8] uint32 desired-access uint32 flags ATTRS attrs On the other hand, in the current jsch implementation, filenames have been sent in the local default encoding. I'll fix it in the next version, but it will cause the troubles for others. It seems to me that OpenSSH(for example, openssh-4.7p1)'s sftp-server has not implemented such encoding conversion. So, as for the avobe case, if the remote host does not use UTF-8, users will get unexpected results. This is the reason I had not implemented it. |To fix this, I think there should be | Channel.setControlEncoding(String encoding) |So I can specify the encoding to use forr file and |Path names on the remote. At the time the Java unicode |String for arguments is converted to byte arrray, it |Should do so with the default encoding specified by me. Unfortunately, the client does not have the initiative to choose the encoding and filenames must be sent in UTF-8 according to the RFC. [1] http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13 Sincerely, -- Atsuhiko Yamanaka JCraft,Inc. 1-14-20 HONCHO AOBA-KU, SENDAI, MIYAGI 980-0014 Japan. Tel +81-22-723-2150 +1-415-578-3454 Fax +81-22-224-8773 Skype callto://jcraft/ ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ JSch-users mailing list JSch-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jsch-users