smbclient/solaris/smbclient

Ali Hasnain Baqri ali.baqri at sun.com
Fri May 3 03:23:19 GMT 2002


Hi Allen,Urban, All

Thanks for the help. :)

Actually I did check smbclient 2.2.2 on command line on Solaris 5.8.The 
corrupted output it gives is visually same as the corrupted output 
obtained through the input stream of the java Process and thereafter 
printed to log file. Dot to dot they match!

The machine which contains files with names in Japanese is a Windows 
2000 machine. I tried accessing the files through Sun's Java FTP API. In 
this case, if I use an InputStreamReader with Shift-JIS as encoding for 
the stream being read in, I get the file names correctly listed. So 
there is not problem atleast in the Java classes I am using to handle 
the Japanese characters.

InputStreamReader created for a certain encoding will read the stream 
and give out a stream of correct characters. I have even tried reading 
all the bytes into a ByteArrayOutputStream and creating a String with 
all the encoding types. It still does not work. Funnily, none of the 
characters in the String so created is above 255! They are all ASCII! 
Some should be Japanese!

My line of thinking is, they byte stream which is being returned by 
smbclient through Process.getInpuStream() is such that all the Java API 
are interpreting them as ASCII inspite of a proper character encoding 
being set. Can there be a problem with the bytes smbclient returns for 
the character stream it gets from Windows 2000 as file listing?

I am looking into jCIFS too. But I'd like to have an answer to current 
dilemma too. :) Never say die! :)

Thanks again for the help. Who says Open Source is without good support! :)

Regards
Ali

Allen, Michael B (RSCH) wrote:

>
>>-----Original Message-----
>>From:	Urban Widmark [SMTP:urban at teststation.com]
>>On Thu, 2 May 2002, Ali Hasnain Baqri wrote:
>>
>>>I am executing smbclient through java.lang.Process.exec(String[])
>>>I am getting the output through stream from it.
>>>
>>You are aware of the existance of jCIFS?  http://jcifs.samba.org/
>>
>	Actually jCIFS has a problem with Unicode pathnames at the moment. We (actually I)
>	did something dumb that causes the pathnames to be URL encoded. You have to URL
>	encode and decode each path component. I'm actually gearing up to fix this in the next
>	week or so. I know Japanese doesn't work though because someone else was
>	complaining about it recently.
>
>>Not forking a new process will be faster and you will do everything within
>>Java code.
>>
>>>When I list the contents of a directory on Windows containing japanese 
>>>characters, the output is corrupted.
>>>Using InputStreamReader to read the output of smbclient with encoding as
>>>
>	Perhaps you need to use DataInputStream.readUTF? You need to determine what the
>	output encoding is exactly and read it accordingly. But jCIFS is definately a better
>	solution (once I fix the URL encoding BS).
>
>	Mike
>






More information about the smb-clients mailing list