[jcifs] Re: Encoding Problems under Linux ?

Michael Schlegel lulog1 at yahoo.de
Wed Jul 19 09:47:43 GMT 2006


Hi !

I solved my problem by changing the Encoding in
Trans2FindFirstResponse.readString() from "UnicodeLittle" to
"UnicodeLittleUnmarked". This changes works under Linux, Windows and Solaris.
I use a SystemProperty to change between this to encodings if needed (default =
UnicodeLittleUnmarked).

Here is the changed Method (only the changed part):

    String readString( byte[] src, int srcIndex, int len ) {
        String str = null;
        try {
            if( useUnicode ) 
            {
                // should Unicode alignment be corrected for here?#
                boolean useUnmarkedEncoding = "true".equalsIgnoreCase(
System.getProperty( "jcifs.use.unmarked", "true" ) );
                if( useUnmarkedEncoding )
                {
                    str = new String( src, srcIndex, len,
"UnicodeLittleUnmarked" );                
                }
                else
                {
                    str = new String( src, srcIndex, len, "UnicodeLittle" );
                }
            } 
            else 
            {    




More information about the jcifs mailing list