how to write onto a file
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.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 :: ");
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.....
Am Also Having Like The Poblem
What you working not here? Are you talking about the same file?
Originally Posted by mirage_87
this works for me for different languages started from Russian ended with Cantonese.
String fileName = "......";
OutputStream fout = new FileOutputStream(fileName);
OutputStream bout = new BufferedOutputStream(fout);
OutputStreamWriter fwr = new OutputStreamWriter(bout,"UTF-8");
refer examples on java2examples.com
if I'm not mistaken, special unicode characters have to be written out using their actual unicode i.e. \u00F6. Code Charts - Scripts has lists of all unicode characters, google helps too :D