Current encoding is UTF-8 and I want to add BOM to all the files
Context: Windows 8 app certification toolkit throws following error, if BOM is not added:
File C:\x\y\z.js is not properly UTF-8 encoded. Re-save the file as UTF-8 (including Byte Order Mark).
If you are using IDE like eclipse or netbeans, you can select all files and set the encoding.
Other option is open all files in text editor and change.
I know this is an old question but here is how I did it:
create a php file: addBOMtoFile.php and add the following line:
file_put_contents("some_new_file_name.js", "\xEF\xBB\xBF" . mb_convert_encoding(file_get_contents("some_file_name.js"), "UTF-8", "UTF-8"));
C:\php>php addBOMtoFile.php