[jcifs] Using non-ascii smbfilenames
Michael B Allen
mballen at erols.com
Sat Feb 2 19:28:40 EST 2002
On Sat, 02 Feb 2002 14:53:57 +0900
"Talbo David" <chukhonets at hotmail.com> wrote:
> We're working on a project to give web (servlet) access to an NT Fileserver
> and have run up against a problem with Japanese encoded filenames.
> Any pointers would be really appreciated. I couldn't find any references in
> the Smb URL spec or the archives.
> Here's what we get calling list() on an SmbFile with Japanese name.
> Exception in thread "main" jcifs.smb.SmbException: File not found
> at jcifs.smb.SmbTransport.sendTransaction(SmbTransport.java:633)
> at jcifs.smb.SmbSession.sendTransaction(SmbSession.java:117)
> at jcifs.smb.SmbTree.sendTransaction(SmbTree.java:52)
> at jcifs.smb.SmbFile.sendTransaction(SmbFile.java:449)
> at jcifs.smb.SmbFile.list(SmbFile.java:1004)
> at jcifs.smb.SmbFile.list(SmbFile.java:992)
> at List.main(List.java:20)
One thing might be that SMB URLs must be java.net.URLEncoder.encode()'d
if they have any of the URL encoding characters +, @, spaces, etc. If
you have those characters it will be necessary to either instruct users
to encode them with the %XX URL encoding escape sequences, or devise
a new mechanism wereby you encode() eveything after the authentication
information yourself before passing them to an SmbFile* constructor. If
you don't have those characters in the path then that's probably not
Otherwise, are you sure your server is talking Unicode? Japanese software
often use special code pages because even UCS-2 may not encompass the
Japanese character set. If so, the default character encoding on which
the client is running has to use the same codepage (or you might be
able to set this before running the client). I don't know spit about
this with respect to Japanese servers though, I could be way off.
Also, there is a bug in 0.6b8 with respect to URL encoding. You might
try to apply that. It's been posted to the mailing list and should be
in the archives prefixed with [PATCH]. Otherwise, you can wait until
next week when I release the next rev.
If this doesn't give you any clues, send me a -Dlog=ALL trace. I need
to see the hexdumps.
May The Source be with you.
More information about the jcifs