From b1f72c0395b230f231715927ebf40bce0bde0177 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Tue, 23 Sep 2025 23:22:33 +0800 Subject: [PATCH] Fixed multibyte characters in MOBI fragment selectors (#99) --- mobi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobi.js b/mobi.js index 4536be8..bbf6a1e 100644 --- a/mobi.js +++ b/mobi.js @@ -1212,7 +1212,7 @@ class KF8 { const frag = frags.find(frag => frag.index === fid) const offset = skel.offset + skel.length + frag.offset const fragRaw = await this.loadRaw(offset, offset + frag.length) - const str = this.mobi.decode(fragRaw).slice(off) + const str = this.mobi.decode(fragRaw.slice(off)) const selector = getFragmentSelector(str) this.#setFragmentSelector(fid, off, selector) const anchor = doc => doc.querySelector(selector)