[−][src]Function quoted_printable::decode
pub fn decode<R: AsRef<[u8]>>(
input: R,
mode: ParseMode
) -> Result<Vec<u8>, QuotedPrintableError>
Decodes a piece of quoted-printable data.
The quoted-printable transfer-encoding is defined in IETF RFC 2045, section
6.7. This function attempts to decode input that is conformant with that
spec. Note that quoted-printable encoding is independent of charset, and so
this function returns a Vec
Examples
use quoted_printable::{decode, ParseMode}; let decoded = decode("hello=3Dworld=0D=0A".as_bytes(), ParseMode::Robust).unwrap(); assert_eq!("hello=world\r\n", String::from_utf8(decoded).unwrap());
Errors
If this function is called with ParseMode::Strict, then it may return a QuotedPrintableError if it detects that the input does not strictly conform to the quoted-printable spec. If this function is called with ParseMode::Robust, then it will attempt to gracefully handle any errors that arise. This might result in input bytes being stripped out and ignored in some cases. Refer to IETF RFC 2045, section 6.7 for details on what constitutes valid and invalid input, and what a "robust" implementation would do in the face of invalid input.