[jcifs] File naming problem
thomas.bley at simple-groupware.de
Fri Mar 24 17:59:17 GMT 2006
File and directory names encoded in utf-8 always worked for me (no
problems with the length).
Problems are shares with special characters in the name and long share
names with more than 12 characters:
Using Cp850 worked for German Umlaute in share names in jCIFS, but of
course not for russian characters (e.g. I configured a share name with
"abc" tpyed using a russian keyboard layout.). I did not modify Samba
or Windows 2003 configuration.
My code was:
System.setProperty( "jcifs.encoding", "Cp850" );
I found out that unicode share names are differently handled in Samba
and Windows 2003. For both the client WindowsXP has no problems
reading and accessing the unicode share names. When using jCIFS
(latest release) the unicode characters get stripped out or encoded in
a wrong way, so you can't access its contents with getCanonicalPath
(I'll try to get it clear which behaviour happens in samba and which
one in win2k3 and send a dump).
My solution is to create a second share with an us-ascii name <13
characters. Some have automatic homeDirs named by usernames as shares
(e.g. usernames like "administrator" are too long): They can be
accessed by reading the homeDir out of LDAP or define a wildcard in
the webdisk configuration.
On 3/24/06, Michael B Allen <mba2000 at ioplex.com> wrote:
> Did you ever try this Thomas?
> On Sat, 31 Dec 2005 02:19:13 -0500
> Michael B Allen <mba2000 at ioplex.com> wrote:
> > On Sat, 31 Dec 2005 05:41:55 +0100
> > Thomas Bley <thomas.bley at simple-groupware.de> wrote:
> > > I also tried:
> > > System.setProperty( "jcifs.encoding", "Cp1252" ); // gives test______?
> > > System.setProperty( "jcifs.encoding", "ISO8859_1" ); // gives test???
> > > System.setProperty( "jcifs.encoding", "UTF8" ); // gives test???
> > > System.setProperty( "jcifs.encoding", "ASCII" ); // gives test???
> > Try:
> > System.setProperty( "jcifs.encoding", "Cp850" );
> > Running $ testparm -v | grep dos shows that Samba's default OEM encoding
> > is Cp850 which is MS-DOS Latin1 which is not the same as ISO-8859-1.
> > I think perhaps we should change the default OEM_ENCODING from the
> > file.encoding property to Cp850.
> > Mike
More information about the jcifs