It's maybe not the best of the best in the CSV world, but Excel likes to have a BOM at the beginning of the file to read it properly. It could be a good idea to add an option to write it, since there is already an implementation to read it.
For now, I'm using as a quick "hack" to make the CSV look good in Excel:
let csv = try CSVWriter(...codecType: UTF8.self,...)
csv.stream.write([0xef, 0xbb, 0xbf], maxLength: 3) // UnicodeBOM.utf8
It's maybe not the best of the best in the CSV world, but Excel likes to have a BOM at the beginning of the file to read it properly. It could be a good idea to add an option to write it, since there is already an implementation to read it.
For now, I'm using as a quick "hack" to make the CSV look good in Excel: