[fix]fix the situation that pijul recognized UTF-8 text file with UTF-8 BOM as binary
Dependencies
- [2]
HWYGVLP5Replacing the temporary copy of chardetng with the published version - [3]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting).
Change contents
- replacement in libpijul/src/lib.rs at line 722
if encoding.encode(&s).0 == buffer {let reencoded = encoding.encode(&s).0;// Special handling for UTF-8 BOM: encoding_rs doesn't preserve BOM during encode,// but the file is still valid UTF-8 text. Check if the only difference is a UTF-8 BOM.if reencoded == buffer {return Some(e);} else if encoding == encoding_rs::UTF_8&& buffer.starts_with(b"\xef\xbb\xbf")&& &buffer[3..] == &*reencoded {// The file has a UTF-8 BOM prefix, which is removed during decode/encode.// This is still valid UTF-8 text.