VMOYG7MKEWTUEEY2EOL256RWCVPGRD63IFOSKXHBGJ6VSRITLMOAC
1,
std::str::from_utf8(&v)
.unwrap()
.lines()
.filter(|l| l.starts_with("-")
&& l.contains("French / Français (ISO Latin-1 / ISO 8859-1)"))
.count()
vec![
"- French / Français (ISO Latin-1 / ISO 8859-1)",
"+ Français / French (ISO Latin-1 / ISO 8859-1)"
],
lines
working_copy.read_file(&item.full_path, &mut self.rec.contents)?;
let mut uncoded = Vec::new();
working_copy.read_file(&item.full_path, &mut uncoded)?;
let encoding = if tree_magic_mini::from_u8(&uncoded).starts_with("text/") {
let mut detector = EncodingDetector::new();
detector.feed(&uncoded, true);
let encoding = detector.guess(None, true);
debug!("guessed encoding = {:?}", encoding.name());
let (decoded, encoding, malformed) = encoding.decode(&uncoded);
debug!("final encoding = {:?}", encoding.name());
if !malformed {
self.rec.contents.append(&mut decoded.as_bytes().to_vec());
Some(encoding)
} else {
warn!("text file was malformed");
self.rec.contents.append(&mut uncoded);
None
}
} else {
self.rec.contents.append(&mut uncoded);
None
};
let mut detector = EncodingDetector::new();
detector.feed(&contents, true);
let encoding = detector.guess(None, true);
debug!("guessed encoding = {:?}", encoding.name());
let (contents, encoding, malformed) = encoding.decode(&contents);
debug!("final encoding = {:?}", encoding.name());
if malformed {
warn!("text file was malformed, should probably try binary instead")
}
for a in contents.split_terminator('\n') {
for a in std::str::from_utf8(&contents)
.unwrap()
.split_terminator('\n')
{