[jcifs] Failed to access files on Samba server with path in Chinese

joller joller at intumit.com
Mon Dec 20 06:19:09 GMT 2004


Hi all, 
  
  I've encountered a problem concerning NO-ASCII file name. 
  When I use jcifs as the client to access a file
  with Chinese (Big5) characters in its path, 
  it works well if the server is a Win32 PC.
  But if the server is a Samba server on Linux, 
  I fail to read the content of it, though a SmbFile.exists()
  return true on the URL:

     SmbFile f = 
         new SmbFile("smb://hostname/share/SOME_CHINESE_FILE_NAME");

     System.out.println(f.exists());  // returns true!
     f.getInputStream();              // throws a SmbException as follows

  The last sentence throws a SmbException:

Exception in thread "main" jcifs.smb.SmbException: The system cannot find
the file specified.
	at jcifs.smb.SmbTransport.send(SmbTransport.java:704)
	at jcifs.smb.SmbSession.send(SmbSession.java:232)
	at jcifs.smb.SmbTree.send(SmbTree.java:103)
	at jcifs.smb.SmbFile.send(SmbFile.java:724)
	at jcifs.smb.SmbFile.open0(SmbFile.java:862)
	at jcifs.smb.SmbFile.open(SmbFile.java:880)
	at jcifs.smb.SmbFileInputStream.<init>(SmbFileInputStream.java:70)
	at jcifs.smb.SmbFileInputStream.<init>(SmbFileInputStream.java:64)
	at jcifs.smb.SmbFile.getInputStream(SmbFile.java:2469)

  If the URL is actually a directory, I cannot get its file list.

  There is no problem if the client is Win32 file manager. 
  Only when the client is Jcifs and the server is a Samba does this happen.

  Is there any solution or workaround to this problem?

    joller




More information about the jcifs mailing list