Hello Jayson!
Make an easy test:
import java.io.*;
public class A{
public static void main(String args[]){
try{
Writer w = new OutputStreamWriter( new FileOutputStream(
args[0] ), args[1] );
w.write( "\u0423\u0440\u0430!" ); /*these are cyrillic
chars, the word is 'Hurray!'*/
w.close();
}catch( Exception e ){
e.printStackTrace();
}
}
}
Now try
java A file1.txt windows-1251
and look at file1.txt. You'll see four bytes of text there. 3
character codes that will mean nothing to you and a '!' mark.
These codes are 'windows-1251' encoding of the \u0423\u0440\u0430
unicode chars.
Now try
java A file2.txt ISO-8859-1
and look at file2.txt. You'll see ???! This means that java internals
were unable to encode \u0423\u0440\u0430 in the encoding ISO-8859-1.
Does this explain how you get the ??? in your file names? My guess is
that your java reads the names of the files okay but is unable to
System.println them due to the problem described. Try printing
character codes instead of chars to System.out
This is my interpretation of your mail. You haven't told me how the
experiment with .list() went on? Did you get ??? on your screen?
Then try printing out the character codes like
for (int i=0;i<s.length;++i){
System.out.print("0x"+(int)(s.charAt(i)));
}
They you may use some character code table for Unicode's Chinese
subset to find out if the file name is okay.
Hope this helps!
JJC> Hello Anton ,
JJC> What is see is question marks in case of chinese files!!
JJC> Anton Tagunov
JJC> <tagunov@newm To: Jayson Joseph Chacko
<[EMAIL PROTECTED]>
JJC> ail.ru> cc: [EMAIL PROTECTED]
JJC> Subject: Re: chinese file handling
JJC> 02/04/02
JJC> 08:41 PM
JJC> Please
JJC> respond to
JJC> Anton Tagunov
JJC> Hello Jayson!
JJC>> Hi,
JJC>> I have a web application which requires reading of the chinese
JJC> files on
JJC>> the server (Windows NT) and importing them.
JJC>> But in java it seems this is impossible. Most of the windows
JJC> applications
JJC>> also give error ( "????? cannot be found")
JJC>> WIndows NT is english with chinese fonts installed.
JJC> Try this
JJC> File f = new File("c:\path-to-the-directory");
JJC> String dir[] = f.list();
JJC> see what you have in the dir array.
JJC> Do you see your file there?
JJC> - Anton
JJC> [EMAIL PROTECTED]
JJC> [EMAIL PROTECTED]
JJC> __________
JJC> ��������� ������, � ��������� ��� - http://www.newhost.ru
- Anton
[EMAIL PROTECTED]
[EMAIL PROTECTED]
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html