17 releases

0.5.1 Jul 16, 2024
0.5.0 Jun 23, 2023
0.4.8 Apr 29, 2023
0.4.7 Feb 1, 2023
0.3.0 Jun 10, 2016

#67 in Parser implementations

Download history 47520/week @ 2024-07-14 55422/week @ 2024-07-21 56065/week @ 2024-07-28 57116/week @ 2024-08-04 57699/week @ 2024-08-11 60065/week @ 2024-08-18 61968/week @ 2024-08-25 58651/week @ 2024-09-01 59417/week @ 2024-09-08 52494/week @ 2024-09-15 62462/week @ 2024-09-22 58784/week @ 2024-09-29 63278/week @ 2024-10-06 66876/week @ 2024-10-13 64853/week @ 2024-10-20 63897/week @ 2024-10-27

263,826 downloads per month
Used in 170 crates (19 directly)

0BSD license

35KB
656 lines

quoted-printable

Build Status Crate

A quoted-printable decoder and encoder.

API

quoted-printable exposes three functions at the moment:

    decode<R: AsRef<[u8]>>(input: R, mode: ParseMode) -> Result<Vec<u8>, QuotedPrintableError>
    encode<R: AsRef<[u8]>>(input: R) -> Vec<u8>
    encode_to_str<R: AsRef<[u8]>>(input: R) -> String

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 and encode_to_str functions obviously do the reverse, and convert a set of raw bytes into quoted-printable.

no_std

This crate supports no_std. By default the crate targets std via the std feature. You can deactivate the default-features to support no_std like this:

quoted-printable = { version = "*", default-features = false }

Documentation

See document on https://docs.rs.

No runtime deps

Features