rfc2047_decoder

Function decode

Source
pub fn decode<T: AsRef<[u8]>>(encoded_str: T) -> Result<String, Error>
Expand description

Decodes the given RFC 2047 MIME Message Header encoded string using a default decoder.

This function equals doing Decoder::new().decode.

ยงExample

use rfc2047_decoder::{decode, Decoder};

let encoded_message = "=?ISO-8859-1?Q?hello_there?=".as_bytes();
let decoded_message = "hello there";

// This ...
assert_eq!(decode(encoded_message).unwrap(), decoded_message);

// ... equals this:
assert_eq!(Decoder::new().decode(encoded_message).unwrap(), decoded_message);