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

joller joller at intumit.com
Mon Dec 20 09:46:48 GMT 2004

Michael B Allen <mba2000 <at> ioplex.com> writes:

> The Samba server is probably configured to use an 8 bit encoding as
> opposed to Unicode. By default jCIFS will use the 'file.encoding' System
> property to decode filenames. Therefore jCIFS will only behave properly
> with default settings if both the Samba server codepage and the Java VM
> file.encoding are compatible. If they are not compatible, you can override
> the encoding using the 'jcifs.encoding' property. Such as:
>   jcifs.encoding=Big5
> Mike

Hi Mike, 

  In fact we have tried to set the property `jcifs.encoding', 
  and the result is as follows:
  With this property set to `big5', SmbFile.exists() returns true, 
  while SmbFile.getInputStream() fails with the same exception
  as mentioned;
  With `utf8', SmbFile.exists() returns *false*, 
  and SmbFile.getInputStream() fails with the same exception. 
  It seems that big5 is the correct encoding. 

  Besides, I wonder why there is no such problem when the client 
  is a Windows file manager.
  If the server is not a Samba, but is a Windows PC instead, 
  there is no such problem either.
  Does this mean that the way jcifs talks to the server is different from 
  that of a Windows file manager?

  And why SmbFile.exists() correctly returns true in this case?
  SmbFile.lastModified() also returns the correct information.
  It seems that querying information of a file works fine with Chinese path.

  Thanks for replying very much!


More information about the jcifs mailing list