fn truncate_utf8(data: &str, length: usize) -> Option<Vec<u8>>
Truncate a UTF8 slice to the longest prefix that is still a valid UTF8 string, while being less than length bytes and non-empty
length