3 Replies Latest reply on Aug 2, 2010 7:07 PM by 843790

    Writing special characters to a file

      I need to write special characters to a file. Currently I'm using PrintWriter:
      String s = "ÿ";
      PrintWriter p = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path), "UTF8")));
      The character I want to print is a y with 2 dots above it (but I have the same problem with other characters like Ø)
      The character is correctly displayed in my console through system.out, but after I opened my file, I find that my character is show as 2 characters: ÿ

      I added UTF8 as you can see above, because I thought that it might be written as ASCII, but without any luck.

      Any idea how I can do this??