writing unicode character in text file 
July 3rd, 2009, 01:23 PM
| | Newbie | | Join Date: Oct 2008
Posts: 26
| | |
Hi,
I am trying to write japanese character in text file (actually trying to create a shell file), to execute some exe placed at that location.
Please help me with this, i need some solution very urgently.
fyi, i am using this code to read unicode character from another file.
String triggerFilePath = "/" + "BuildCopy" + File.separator + "Trigger.txt";
//http://bytes.com/groups/java/16986-how-specify-encoding-java
InputStream is = new BufferedInputStream(new FileInputStream(triggerFilePath));
Reader reader = new InputStreamReader(is, "UTF-8");
BufferedReader dataFile= new BufferedReader(reader);
String currentRecord = dataFile.readLine();
thanks in advance,
Rahul
| 
July 3rd, 2009, 01:37 PM
|  | Expert | | Join Date: Mar 2007
Posts: 10,634
Provided Answers: 2 | | | re: writing unicode character in text file Quote:
Originally Posted by rahullko05 I am trying to write japanese character in text file (actually trying to create a shell file), to execute some exe placed at that location.
Please help me with this, i need some solution very urgently. | Although it may be urgent to you, it isn't urgent to us; btw, you mentioned writing characters to a file but all I see is InputStreams and Readers; they are for reading (from a file).
kind regards,
Jos
| 
July 4th, 2009, 07:27 AM
| | Newbie | | Join Date: Oct 2008
Posts: 26
| | | re: writing unicode character in text file
i have just given the code which i am using to read the file containing unicode characters. where i am stuck is how to write a file with same unicode characters contained in string.
| 
July 4th, 2009, 08:15 AM
|  | Expert | | Join Date: Mar 2007
Posts: 10,634
Provided Answers: 2 | | | re: writing unicode character in text file Quote:
Originally Posted by rahullko05 i have just given the code which i am using to read the file containing unicode characters. where i am stuck is how to write a file with same unicode characters contained in string. | It's exactly the same but the other way around, so you have to use a FileOutputStream, an OutputStreamWriter and a BufferedWriter. btw, you're buffereing to much in your reading procedure: you buffer the stream and the reader; that doesn't help you much, buffer only once.
kind regards,
Jos
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,652 network members.
|