Skip to content

Commit

Permalink
increase isutf8_file() helper fn sample from 512 to 1024k
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
jqnatividad committed Dec 5, 2023
1 parent dbfdc54 commit d1d8a10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool, CliError> {
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
Expand Down

0 comments on commit d1d8a10

Please sign in to comment.