Using VIM
-
Open file in VIM:
vi text.xml
-
Remove BOM encoding:
:set nobomb
-
Save and quit:
:wq
For a non-interactive solution, try the following command line:
vi -c ":set nobomb" -c ":wq" text.xml
That should remove the BOM, save the file and quit, all from the command line.