[−][src]Function quoted_printable::encode_to_str
pub fn encode_to_str<R: AsRef<[u8]>>(input: R) -> String
Encodes some bytes into quoted-printable format.
The difference to encode is that this function takes advantage of
the fact that the Vec<u8> returned by encode can only contain
valid us-ascii and converts it to a String (using the unsafe
String::from_utf8_unchecked).
The quoted-printable transfer-encoding is defined in IETF RFC 2045, section 6.7. This function encodes a set of raw bytes into a format conformant with that spec. The output contains CRLF pairs as needed so that each line is wrapped to 76 characters or less (not including the CRLF).
Examples
use quoted_printable::encode_to_str;
let encoded = encode_to_str("hello, \u{20ac} zone!");
assert_eq!("hello, =E2=82=AC zone!", encoded);