title: Writing unicode to rtf file
body: <p>I´m trying write strings in diffrent languages to a rtf file. I hav tried a few different things.
  I use japanese here as an example but it´s the same for other languages i have tried.</p>
  
  <pre><code>public void writeToFile(){
  
      String strJapanese = "日本語";
      DataOutputStream outStream;
      File file = new File("C:\\file.rtf");
  
      try{
  
          outStream = new DataOutputStream(new FileOutputStream(file));
          outStream.writeBytes(strJapanese);
          outStream.close();
  
      }catch (Exception e){
          System.out.println(e.toString());
      }
  }
  </code></pre>
  
  <p>I alse have tried:</p>
  
  <pre><code>byte[] b = strJapanese.getBytes("UTF-8");
  String output = new String(b);
  </code></pre>
  
  <p>Or more specific:</p>
  
  <pre><code>byte[] b = strJapanese.getBytes("Shift-JIS");
  String output = new String(b);
  </code></pre>
  
  <p>The output stream also has the writeUTF method:</p>
  
  <pre><code>outStream.writeUTF(strJapanese);
  </code></pre>
  
  <p>You can use the byte[] directly in the output stream with the write method. All of the above gives me garbled characters for everything except west european languages. To see if it works I have tried opening the result document in notepad++ and set the appropriate encoding. Also i have used OpenOffice where you get to choose encoding and font when opening the document.</p>
  
  <p>If it does work but my computer can´t open it properly, is there a way to check that?</p>