Added support for UTF-16 files with BOM, and respect for UTF-8 BOM