From 0010944ef5a997de864d3c2471c3e8f50f9126b3 Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Thu, 10 Jul 2025 09:24:07 +0100 Subject: [PATCH] Fix null character count for Latin 1 string decoding --- src/files.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/files.rs b/src/files.rs index 29224081b..3d23fd954 100644 --- a/src/files.rs +++ b/src/files.rs @@ -254,7 +254,7 @@ pub(crate) fn guess_content( // ISO-8859-1 aka Latin 1), treat them as such. let (latin1_str, _encoding, saw_malformed) = encoding_rs::WINDOWS_1252.decode(bytes); if !saw_malformed { - let num_null = utf16_string + let num_null = latin1_str .chars() .take(5000) .filter(|c| *c == std::char::REPLACEMENT_CHARACTER || *c == '\0')