Add BOM header for UTF-8 encoded output files, may need further revision. Take care!