UTF-8 decoding bug

This commit is contained in:
Dhanji Prasanna
2025-10-12 14:54:28 +11:00
parent 05c21b61df
commit 037bff7021

View File

@@ -1469,7 +1469,12 @@ The tool will execute immediately and you'll receive the result (success or erro
} }
} else { } else {
if s.len() > 100 { if s.len() > 100 {
format!("{}...", &s[..100]) // Use char_indices to respect UTF-8 boundaries
let truncated = s.char_indices()
.take(100)
.map(|(_, c)| c)
.collect::<String>();
format!("{}...", truncated)
} else { } else {
s.clone() s.clone()
} }