Allow UTF8 files with BOM to be processed

I only made changes in lines 88-100 - for whatever reason, it replaced the whole file.