|
how to write onto a file
hi,
i m trying to write onto a file.Some of my text is in english and some in urdu.The problem that i m facing is i m able to write the english part correctly but not the urdu part.Here's my code..........
//urdu_synset contains the urdu string
//string1,string2,etc are english strings
fw=new FileWriter("news.txt",true);
fw.write(" \n" + "\n" + "ID :: " + string1 + "\n");
fw.write("CAT :: " + string2 + "\n");
fw.write("CONCEPT :: " + string3 + "\n");
fw.write("EXAMPLE :: " + string4 + "\n");
fw.write("SYNSET-URDU :: ");
fw.close();
fos=new FileOutputStream("news.txt",true);
osw=new OutputStreamWriter(fos,"Unicode");
osw.write(urdu_synset);
osw.flush();
i tried writin the urdu string into a different file using OutputStreamWriter in "unicode" format and it worked fine.....but it 's not workin out here....the string comes out to be garbled...........................
please suggest any suitable solution to my problem.....
|