Hi,
+-From: "Oberhuber, Martin" <[EMAIL PROTECTED]> --
|_Date: Wed, 26 Sep 2007 18:02:08 +0200 _______________________
|
|Given a remote UNIX directory with an '?' or '*' in its name,
|for instance /parent/a?b
|Even if the path name is quoted ("/parent/a\\?b"), calling
|ChannelSftp.ls(quotedDir) does not return the contents of
|dir, but it returns the list of file which reside in
|parent/ and match the pattern a?b.
|The reason for this problem is that
| ChannelSftp.isPattern()
|just checks for occurrence of the characters '?' and '*',
|but does not check whether these characters have been quoted
|with a \ or not.
You are right. There are
ChannelSftp#isPattern(String path) and
ChannelSftp#isPattern(byte[] path)
,but the former hamethod s not cheked carefully. It should be fixed.
|A slightly related problem to this is that unquoting of
|path names is done in the encoded byte[] array rather
|than the Unicode String. Given remote path names that
|are encoded in UTF-8 or similar, there can be characters
|encoded as 2 or three bytes. It's possible that byte
|#2 or byte #3 happen to look like a '?' or '*' character,
|but are actually not.
As you will refer to the encoding rule for UTF-8,
'?' and '*' must not appear in the #2, #3 and surrogate byte.
On the other hand, there are such possibilties in other encoding;
for example, Shift_JIS, CP932(widely used in Japan).
|Therefore, the unquoting must happen in the Unicode string
|rather than the encoded byte[] array -- Util.unquote()
|must use String.toCharArray() and work on that one,
|rather than String.getBytes().
As for filename globbing operation, String.getBytes("UTF-8") will be enought.
Thank you for your feedback.
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users