Added handling of (optional) BOM in UTF-8 encoded files (closes #246).