Correctly write BOM without relying on QTextStream