fix language reading for UTF-8 BOM and any encountered strange sequence of bytes