Fix detection of UTF-8 BOM encoding.