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!