pub fn encode(enc: CharEncoding, input: &str) -> Result<Vec<u8>>
Encodes a Unicode string using the specified character encoding.