mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-10-21 22:49:51 -04:00
Fixed multibyte characters in MOBI fragment selectors (#91)
For Chinese/CJK text, multibyte character offsets were being incorrectly used as bytes offsets after decoding
This commit is contained in:
1 parent
0d4a92ae75
commit
f1d4a4290d
1 file changed
+1
-1
@@ -1142,7 +1142,7 @@ class KF8 {
|
||||
|
||||
const offsets = this.#fragmentOffsets.get(frag.index)
|
||||
if (offsets) for (const offset of offsets) {
|
||||
const str = this.mobi.decode(fragRaw).slice(offset)
|
||||
const str = this.mobi.decode(fragRaw.slice(offset))
|
||||
const selector = getFragmentSelector(str)
|
||||
this.#setFragmentSelector(frag.index, offset, selector)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user