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§
Sourcefn decode(
&self,
bytes: &[u8],
options: &EncodingOptions,
) -> Result<EncodingResult, PdfError>
fn decode( &self, bytes: &[u8], options: &EncodingOptions, ) -> Result<EncodingResult, PdfError>
Decode bytes to string with encoding detection
Sourcefn detect_encoding(&self, bytes: &[u8]) -> Option<EncodingType>
fn detect_encoding(&self, bytes: &[u8]) -> Option<EncodingType>
Detect the most likely encoding for the given bytes
Sourcefn decode_with_encoding(
&self,
bytes: &[u8],
encoding: EncodingType,
lenient: bool,
) -> Result<String, PdfError>
fn decode_with_encoding( &self, bytes: &[u8], encoding: EncodingType, lenient: bool, ) -> Result<String, PdfError>
Convert bytes using a specific encoding