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

Michael B Allen mba2000 at ioplex.com
Wed Dec 22 07:11:57 GMT 2004


On Wed, 22 Dec 2004 05:49:05 +0000 (UTC)
joller <joller at intumit.com> wrote:

> > The System property file.encoding is used to encode path names. I
> > believe we determined that that was already set to Big5. So you do not
> > need to set the encoding. Try it.
> >
> > Mike
> >
>     I meant, the user of the client program will ask to connect to some
>     server and retrieve some files,
>     But the servers the user can specify may not use the same encoding.

First, if Unicode is negotiated then you don't care. The encoding problem
only arises when the server is running on 8-bit mode. Windows uses Unicode
by default so now the problem is narrowed down to CJK user's the like to use
8-bit mode because they have existing filesystems in that encoding. Second,
a user accessing resources on a server will very likely be running on a
locale that is compatible with the server. This means that the file.encoding
will match (as it did in your case).

>     Is there any better way than asking the user to specify the encoding?

If the file.encoding property does not match the server 8-bit encoding you
have a problem because there is no way for CIFS to negotiate the encoding
(Microsoft solved the multiple codepage problem by switching to Unicode). It
is expected that the client and server will simply be configured to use the
same encoding.

Otherwise, there is no way to dynamically change the encoding. Setting
jcifs.encoding programmatically will have no effect after jcifs classes have
been accessed.

Mike

-- 
Greedo shoots first? Not in my Star Wars.


More information about the jcifs mailing list