I am reading a file line by line and splitting it up into multiple files. The output files are xml files but because I'm inadvertently including a BOM Byte Order Mark in my output files I'm getting an error in another application which is trying to load them.
I have found many many links to methods to remove the BOM from existing files or a workaround for reading them. However I'm trying to avoid the problem by finding an alternative way to create the output files in the first place.
I'm developing on a Mac and the program will eventually run on Windows machine. I've tried changing the character set in the code to UTF-8, UTF-16BE and even ASCII. Not sure if I should try writing bytes instead.