Trait CharacterDecoder

Source
pub trait CharacterDecoder {
    // Required methods
    fn decode(
        &self,
        bytes: &[u8],
        options: &EncodingOptions,
    ) -> Result<EncodingResult, PdfError>;
    fn detect_encoding(&self, bytes: &[u8]) -> Option<EncodingType>;
    fn decode_with_encoding(
        &self,
        bytes: &[u8],
        encoding: EncodingType,
        lenient: bool,
    ) -> Result<String, PdfError>;
}
Expand description

Main character decoder trait

Required Methods§

Source

fn decode( &self, bytes: &[u8], options: &EncodingOptions, ) -> Result<EncodingResult, PdfError>

Decode bytes to string with encoding detection

Source

fn detect_encoding(&self, bytes: &[u8]) -> Option<EncodingType>

Detect the most likely encoding for the given bytes

Source

fn decode_with_encoding( &self, bytes: &[u8], encoding: EncodingType, lenient: bool, ) -> Result<String, PdfError>

Convert bytes using a specific encoding

Implementors§