Detect binary files by NUL byte before encoding guess
Dependencies
- [2]
HWYGVLP5Replacing the temporary copy of chardetng with the published version - [3]
6CZYYOG7Faster guessing of encoding - [4]
5FI6SBEZRe-implement change printing and parsing - [5]
SGXOEWHUAdding a patched chardetng (temporarily) - [6]
NYOF5766track file encoding in the record, including change text for file adds - [*]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [*]
7KNPYIDUSplitting the WorkingCopy trait into a read-only record and a read/write output
Change contents
- edit in libpijul/src/working_copy/mod.rs at line 29
let slice = &buffer[init..];if looks_binary(slice) {return Ok(None);} - replacement in libpijul/src/working_copy/mod.rs at line 34
detector.feed(&buffer[init..], true);if let Some(e) = crate::get_valid_encoding(&detector, None, true, &buffer[init..]) {detector.feed(slice, true);if let Some(e) = crate::get_valid_encoding(&detector, None, true, slice) { - edit in libpijul/src/working_copy/mod.rs at line 43[9.30][9.30]
fn looks_binary(buf: &[u8]) -> bool {if buf.is_empty() {return false;}buf.iter().any(|&b| b == 0)}