6 Replies Latest reply on Sep 5, 2008 5:54 PM by 843785

    How to control BOM in writing UTF8 files?

      When I write a text file using UTF8 encoding, the BOM (0xEF0xBB0xBF) is sometimes written to the file, and sometimes not.

      Is there any way to control whether to write BOM?

      My code is
      BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("filename.txt"), "UTF-8"))
      Thanks in advance!