vv9k / mobi-rs

A crate to work with MOBI format ebooks
MIT License
38 stars 10 forks source link

Getting `utf8 decode failed` error on all files #43

Open gsidhu opened 8 months ago

gsidhu commented 8 months ago

Hi, I tried running the crate on mobi files downloaded from Project Gutenberg.

But I am always hit with the utf8 decode failed - invalid utf-8 sequence of 1 bytes from index .... error.

Here's my implementation –

use std::error::Error;
use mobi::Mobi;

pub fn extract(file: &String) -> Result<String, Box<dyn Error>> {
  let mobi_file = Mobi::from_path(file)?;
  let text = mobi_file.content_as_string()?;
  Ok(text)
}

I am using rustc 1.76.0 and mobi = "0.8.0".

Is the issue in the crate or my implementation?