Skip to content

Commit

Permalink
fix truncate in middle of unicode char
Browse files Browse the repository at this point in the history
  • Loading branch information
kindly committed Jan 25, 2024
1 parent 6e6b4cb commit 2c28a26
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2587,7 +2587,11 @@ impl FlatFiles {

if cell.len() > 32767 {
log::warn!("WARNING: Cell larger than 32767 chararcters which is too large for XLSX format. The cell will be truncated, so some data will be missing.");
cell.truncate(32767)
let mut index: usize = 32767;
while !cell.is_char_boundary(index) {
index -= 1;
}
cell.truncate(index)
}

if metadata.describers[order].guess_type().0 == "number" {
Expand Down Expand Up @@ -4376,7 +4380,7 @@ mod tests {
json!({}),
)
}

#[test]
fn test_s3_input() {
if std::env::var("AWS_DEFAULT_REGION").is_ok() {
Expand Down

0 comments on commit 2c28a26

Please sign in to comment.