Connecting Tech Pros Worldwide Help | Site Map

writing unicode character in text file

  #1  
Old 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
  #2  
Old July 3rd, 2009, 01:37 PM
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,634
Provided Answers: 2

re: writing unicode character in text file


Quote:
Originally Posted by rahullko05 View Post
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
  #3  
Old 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.
  #4  
Old July 4th, 2009, 08:15 AM
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,634
Provided Answers: 2

re: writing unicode character in text file


Quote:
Originally Posted by rahullko05 View Post
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
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing Unicode to database using ODBC Mudcat answers 1 September 4th, 2008 12:35 AM
Writing extended ascii characters to text file. JSM answers 3 November 16th, 2005 06:56 PM
unicode text file Koulbak answers 14 July 23rd, 2005 05:45 AM
Will standard C++ allow me to replace a string in a unicode-encoded text file? Eric Lilja answers 8 July 23rd, 2005 02:04 AM