I am having issues with removing trailing null characters from UTF-8 encoded strings:
How would one go about removing these characters from a String?
Here is the code I use to create the String from a Vec:
let mut data: Vec<u8> = vec![0; 512];
// populate data
let res = String::from_utf8(data).expect("Found invalid UTF-8");

\0? Usually C strings contain one\0right after the string and every character after that might be garbage.