From d1d8a1042b784dda622c77f196bdd636e57c2925 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Mon, 4 Dec 2023 20:37:26 -0500 Subject: [PATCH] increase isutf8_file() helper fn sample from 512 to 1024k [skip ci] --- src/util.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.rs b/src/util.rs index 5632e98c4..f1d435a39 100644 --- a/src/util.rs +++ b/src/util.rs @@ -1413,10 +1413,10 @@ pub fn to_lowercase_into(s: &str, buf: &mut String) { } } -/// load the first BUFFER*4 (128k) bytes of the file and check if it is utf8 +/// load the first BUFFER*8 (1024k) bytes of the file and check if it is utf8 pub fn isutf8_file(path: &Path) -> Result { let metadata = std::fs::metadata(path)?; - let buffer_len = config::DEFAULT_RDR_BUFFER_CAPACITY * 4; + let buffer_len = config::DEFAULT_RDR_BUFFER_CAPACITY * 8; let file_size = metadata.len() as usize; let bytes_to_read: usize = if file_size < buffer_len { file_size