writing unicode character in text file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rahullko05
    New Member
    • Oct 2008
    • 34

    writing unicode character in text file

    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.tx t";
    //http://bytes.com/groups/java/16986-how-specify-encoding-java
    InputStream is = new BufferedInputSt ream(new FileInputStream (triggerFilePat h));
    Reader reader = new InputStreamRead er(is, "UTF-8");
    BufferedReader dataFile= new BufferedReader( reader);
    String currentRecord = dataFile.readLi ne();


    thanks in advance,
    Rahul
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    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

    Comment

    • rahullko05
      New Member
      • Oct 2008
      • 34

      #3
      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.

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        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 FileOutputStrea m, an OutputStreamWri ter 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

        Comment

        Working...