rfc2047-decoder

Crates.iorfc2047-decoder
lib.rsrfc2047-decoder
version1.0.5
sourcesrc
created_at2020-12-28 21:16:15.651831
updated_at2024-02-11 17:42:24.337527
descriptionRust library for decoding RFC 2047 MIME Message Headers.
homepagehttps://github.com/TornaxO7/rfc2047-decoder
repositoryhttps://github.com/TornaxO7/rfc2047-decoder
max_upload_size
id328439
size55,615
Clément DOUIN (soywod)

documentation

https://docs.rs/rfc2047-decoder

README

rfc2047-decoder Crates.io Crates.io

State

This project is considered as finished, only bugs will be fixed so don't wonder, if the last commit is a long time ago.

Introduction

Rust library for decoding RFC 2047 MIME Message Headers.

use rfc2047_decoder;

fn main() {
    let encoded_str = "=?UTF-8?Q?str?=";
    let decoded_str = "str";

    // using the decode helper (default options)
    assert_eq!(
        rfc2047_decoder::decode(encoded_str.as_bytes()).unwrap(),
        decoded_str
    );

    // using the decoder builder (custom options)
    assert_eq!(
        rfc2047_decoder::Decoder::new()
            .too_long_encoded_word_strategy(rfc2047_decoder::RecoverStrategy::Skip)
            .decode(encoded_str.as_bytes())
            .unwrap(),
        decoded_str
    );
}

Sponsoring

github paypal ko-fi buy-me-a-coffee liberapay

Commit count: 76

cargo fmt