[jcifs] Encoding Problems under Linux ?

Michael B Allen mba2000 at ioplex.com
Thu Jul 13 16:17:10 GMT 2006


There are a number of places where the encoding of path names can be
different. You have the remote filesystem, then the server may translate
that into a different encoding, the client might then translate it
again, the client's internal encoding, and then the client filesystem
encoding. It sounds like you're not concerned with the last three
possibilities and if the remote server is really a Windows machine
running NT or above then the remote server will send Unicode (unless
you have useUnicode set to false). So in all likelyhood you need only
tweek the jcifs.encoding property but the defaults should work.

Try setting jcifs.encoding to CP850. Note that some JVMs do not ship with
CP850 support. See the notes in the API documentation about this property.

Mike

[1] Note CP850 is 

On Thu, 13 Jul 2006 13:50:49 +0000 (UTC)
Michael Schlegel <lulog1 at yahoo.de> wrote:

> Hi !
> 
> I use jcifs 1.2.9.
> I try to connect a Windows-FileShare from a Linux-System (Red Hat).
> To test the connection i used the AclCrawler example, but i got some exceptions.
> 3 Files/directories should be listed but jcifs found 5 files/directories.
> Also the names of the files/directories are crypted. I tried to set some
> properties (like jcifs.encoding) but nothing helps. Under Solaris and Windows
> this example works very well.
> 
> --- found 5 Files
> smb://usu843@usu843/frei/â¸/ Directory: true, null
> jcifs.smb.SmbException: The system cannot find the file specified.
>         at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:510)
>         at jcifs.smb.SmbTransport.send(SmbTransport.java:610)
>         at jcifs.smb.SmbSession.send(SmbSession.java:231)
>         at jcifs.smb.SmbTree.send(SmbTree.java:102)
>         at jcifs.smb.SmbFile.send(SmbFile.java:687)
>         at jcifs.smb.SmbFile.open0(SmbFile.java:827)
>         at jcifs.smb.SmbFile.getSecurity(SmbFile.java:2516)
>         at AclCrawler.traverse(AclCrawler.java:30)
>         at AclCrawler.main(AclCrawler.java:77)
> smb://usu843@usu843/frei/â¸â¸/ Directory: true, null
> jcifs.smb.SmbException: The system cannot find the file specified.
>         at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:510)
>         at jcifs.smb.SmbTransport.send(SmbTransport.java:610)
>         at jcifs.smb.SmbSession.send(SmbSession.java:231)
>         at jcifs.smb.SmbTree.send(SmbTree.java:102)
>         at jcifs.smb.SmbFile.send(SmbFile.java:687)
>         at jcifs.smb.SmbFile.open0(SmbFile.java:827)
>         at jcifs.smb.SmbFile.getSecurity(SmbFile.java:2516)
>         at AclCrawler.traverse(AclCrawler.java:30)
>         at AclCrawler.main(AclCrawler.java:77)
> smb://usu843@usu843/frei/æ¨æ
>                             çæ
>                               / Directory: true, null
> jcifs.smb.SmbException: The system cannot find the file specified.
>         at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:510)
>         at jcifs.smb.SmbTransport.send(SmbTransport.java:610)
>         at jcifs.smb.SmbSession.send(SmbSession.java:231)
>         at jcifs.smb.SmbTree.send(SmbTree.java:102)
>         at jcifs.smb.SmbFile.send(SmbFile.java:687)
>         at jcifs.smb.SmbFile.open0(SmbFile.java:827)
>         at jcifs.smb.SmbFile.getSecurity(SmbFile.java:2516)
>         at AclCrawler.traverse(AclCrawler.java:30)
>         at AclCrawler.main(AclCrawler.java:77)
> smb://usu843@usu843/frei/ä°ä¤åå¼æ¤æ¸ççæ
>                                        æ°æ°æçâ¸æ¨æ
>                                                   ç Directory: false, null
> jcifs.smb.SmbException: The system cannot find the file specified.
>         at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:510)
>         at jcifs.smb.SmbTransport.send(SmbTransport.java:610)
>         at jcifs.smb.SmbSession.send(SmbSession.java:231)
>         at jcifs.smb.SmbTree.send(SmbTree.java:102)
>         at jcifs.smb.SmbFile.send(SmbFile.java:687)
>         at jcifs.smb.SmbFile.open0(SmbFile.java:827)
>         at jcifs.smb.SmbFile.getSecurity(SmbFile.java:2516)
>         at AclCrawler.traverse(AclCrawler.java:30)
>         at AclCrawler.main(AclCrawler.java:77)
> smb://usu843@usu843/frei/æ´çã/ Directory: true, null
> jcifs.smb.SmbException: The system cannot find the file specified.
>         at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:510)
>         at jcifs.smb.SmbTransport.send(SmbTransport.java:610)
>         at jcifs.smb.SmbSession.send(SmbSession.java:231)
>         at jcifs.smb.SmbTree.send(SmbTree.java:102)
>         at jcifs.smb.SmbFile.send(SmbFile.java:687)
>         at jcifs.smb.SmbFile.open0(SmbFile.java:827)
>         at jcifs.smb.SmbFile.getSecurity(SmbFile.java:2516)
>         at AclCrawler.traverse(AclCrawler.java:30)
>         at AclCrawler.main(AclCrawler.java:77)
> 
> I took a look into the jdifs sourcecode and changed the encoding in
> Trans2FindFirst2Response.readString() from 'UnicodeLittle' to 'ISO8859_1' and i
> saw the correct file/directory names but also i got the same
> jcifs.smb.SmbException 'The system cannot find the file specified'.
> 
> What i must do to get this example work under linux ?
> 


-- 
Michael B Allen
PHP Extension for SSO w/ Windows Group Authorization
http://www.ioplex.com/


More information about the jcifs mailing list