remove BOM from utf8 files

Copy the implementation in requirejs/text to fix the unexpected BOM in utf8 files.