quoted-printable
A quoted-printable decoder and encoder.
API
quoted-printable exposes two functions at the moment:
using R: AsRef<[u8]>
means that you can pass in a variety of types, including:
String
, &String
, &str
, Vec<u8>
, &Vec<u8>
, &[u8]
, Box<[u8]>
, Arc<[u8]>
The decode function can be used to convert a quoted-printable string into the decoded bytes, as per the description in IETF RFC 2045, section 6.7. The ParseMode option can be used to control whether the decoding is "strict" or "robust", as per the comments in that RFC. In general you should probably use "robust" decoding, as it will gracefully handle more malformed input.
The encode function obviously does the reverse, and converts a set of raw bytes into quoted-printable.
Additionally there is following helper function:
which 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
)
Documentation
See document on https://docs.rs.