use UTF8BOM; UTF8BOM->insert_into_file('/path/to/file');