Character Encoding
Dear All,
I have a problem with reading and writing unicode files. here is the listing.
while((l=in.readLine())!=null){
out.println(l+"haha");
}
the file that i'm trying to read is encoded in 16 bit Unicode(not UTF-8) and the program also writes it to an output file with the same encoding. but all the added text parts("haha") are garbled. I tested the program with UTF-8 and ANSI files and it worked fine. But when I tried to use it with Unicode and Unicode big endian , the problem appeared. My conclusion is that it works fine for utf-8 and ANSI because they both use ASCII encoding for the English characters(which my text is composed of) and when it inserts them to Unicode files it doesn't translate it to Unicode. But, I've read it on Java tutorial that when we use FileReader and FileWriter stream classes, they translate the input characters to Unicode which is the encoding that Java uses and then translate it again to the other encoding when writing. But regarding my experiment I think Java doesn't translate characters to appropriate encoding(in my case 16 bit Unicode).

