Adding UTF-8 BOM (Byte Order Mark) To File Output
We're exporting some data to CSV files and when using CFFILE (write/append) with CHARSET set to "utf-8", the file seems to be properly encoded, but there's not BOM (byte order mark) at the beginning of the file.
As far as I know, this is standard practice as the BOM is optional. Some applications (like Notepad) open the file just fine, and render the UTF-8 accented characters, angled quotations, etc. just fine.
Excel, however, has issues when opening the file if the BOM is not present. If I manually add the BOM to the beginning of the file using another application, Excel opens it fine (and so does Notepad).
Is there a simple / recommended way to add the BOM to the file using CFFILE or other built-in functionality?
The BOM character entry in UTF-8 is U+FEFF (65279) or EF, BB, BF in raw hex. So currently, I'm starting our file output with CHR(65279), and this does seem to work.
Thanks
